30 lines
939 B
PHP
30 lines
939 B
PHP
<?php
|
|
require_once 'config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
|
|
// Add latitude and longitude columns to food_listings
|
|
// Using DECIMAL(10, 8) and DECIMAL(11, 8) for sufficient precision
|
|
$sql_alter_lat = "ALTER TABLE food_listings ADD COLUMN latitude DECIMAL(10, 8) NULL AFTER description";
|
|
$sql_alter_lon = "ALTER TABLE food_listings ADD COLUMN longitude DECIMAL(11, 8) NULL AFTER latitude";
|
|
|
|
try {
|
|
$pdo->exec($sql_alter_lat);
|
|
echo "Added 'latitude' column to 'food_listings' table.\n";
|
|
} catch (PDOException $e) {
|
|
echo "Could not add 'latitude' column (maybe it already exists).\n";
|
|
}
|
|
|
|
try {
|
|
$pdo->exec($sql_alter_lon);
|
|
echo "Added 'longitude' column to 'food_listings' table.\n";
|
|
} catch (PDOException $e) {
|
|
echo "Could not add 'longitude' column (maybe it already exists).\n";
|
|
}
|
|
|
|
} catch (PDOException $e) {
|
|
die("DB ERROR: " . $e->getMessage());
|
|
}
|
|
|