Untuk Deploy

This commit is contained in:
TigerStable
2026-06-12 21:50:22 +07:00
parent 41c86ecc08
commit b0b94ecec3
4 changed files with 74 additions and 11 deletions
+23 -11
View File
@@ -1,18 +1,30 @@
<?php
require_once 'db.php';
$sql = "
CREATE TABLE IF NOT EXISTS features (
id VARCHAR(100) PRIMARY KEY,
layer VARCHAR(50) NOT NULL,
data JSON NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_layer ON features(layer);
";
try {
$pdo->exec($sql);
$pdo->exec("
CREATE TABLE IF NOT EXISTS features (
id VARCHAR(100) PRIMARY KEY,
layer VARCHAR(50) NOT NULL,
data JSON NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
");
$stmt = $pdo->prepare("
SELECT 1
FROM information_schema.statistics
WHERE table_schema = DATABASE()
AND table_name = 'features'
AND index_name = 'idx_layer'
LIMIT 1
");
$stmt->execute();
if (!$stmt->fetchColumn()) {
$pdo->exec("CREATE INDEX idx_layer ON features(layer)");
}
echo "Database table 'features' created successfully.";
} catch (PDOException $e) {
echo "Error creating table: " . $e->getMessage();