edit files
This commit is contained in:
+2
-2
@@ -54,8 +54,8 @@ services:
|
||||
SERVICE_FQDN_PHPMYADMIN:
|
||||
PMA_HOST: mysql
|
||||
PMA_PORT: 3306
|
||||
PMA_USER: ${MYSQL_USER:-webgis}
|
||||
PMA_PASSWORD: ${MYSQL_PASSWORD:-webgis_password}
|
||||
PMA_USER: root
|
||||
PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root_password}
|
||||
PMA_ABSOLUTE_URI: ${SERVICE_URL_PHPMYADMIN:-}
|
||||
depends_on:
|
||||
mysql:
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
$host = getenv('DB_HOST') ?: 'mysql';
|
||||
$port = (int)(getenv('DB_PORT') ?: 3306);
|
||||
$user = 'root';
|
||||
$pass = getenv('MYSQL_ROOT_PASSWORD') ?: 'root_password';
|
||||
|
||||
echo "Menghubungkan ke database...<br>\n";
|
||||
$conn = new mysqli($host, $user, $pass, '', $port);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
die("Koneksi gagal: " . $conn->connect_error);
|
||||
}
|
||||
echo "Koneksi berhasil!<br>\n";
|
||||
|
||||
$conn->set_charset('utf8mb4');
|
||||
|
||||
function executeSqlFile($conn, $filePath) {
|
||||
if (!file_exists($filePath)) {
|
||||
echo "File tidak ditemukan: $filePath<br>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
echo "Mengeksekusi $filePath...<br>\n";
|
||||
$sql = file_get_contents($filePath);
|
||||
|
||||
// Execute multi query
|
||||
if ($conn->multi_query($sql)) {
|
||||
do {
|
||||
// Store first result set
|
||||
if ($result = $conn->store_result()) {
|
||||
$result->free();
|
||||
}
|
||||
// print divider
|
||||
} while ($conn->more_results() && $conn->next_result());
|
||||
echo "✅ Sukses mengeksekusi $filePath<br>\n";
|
||||
} else {
|
||||
echo "❌ Gagal mengeksekusi $filePath: " . $conn->error . "<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Urutan eksekusi file SQL
|
||||
executeSqlFile($conn, __DIR__ . '/01/database_01.sql');
|
||||
executeSqlFile($conn, __DIR__ . '/02/database_02.sql');
|
||||
executeSqlFile($conn, __DIR__ . '/05/webgis_uas_FIXED_v2/webgis_uas_FIXED/database_LENGKAP.sql');
|
||||
|
||||
echo "<br><b>SEMUA DATABASE BERHASIL DIBUAT DAN DI-MIGRASI!</b> Anda bisa menghapus file setup_db.php ini nanti.";
|
||||
?>
|
||||
Reference in New Issue
Block a user