MAPG-3 add initial SQL structure

This commit is contained in:
Bence Pőcze 2020-05-17 22:31:13 +02:00
parent 555984caf5
commit 033e03335f

27
install/db.sql Normal file
View File

@ -0,0 +1,27 @@
SET NAMES utf8mb4;
SET foreign_key_checks = 0;
DROP TABLE IF EXISTS `maps`;
CREATE TABLE `maps` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text NOT NULL,
`bound_south_lat` decimal(8,6) NOT NULL,
`bound_west_lng` decimal(9,6) NOT NULL,
`bound_north_lat` decimal(8,6) NOT NULL,
`bound_east_lng` decimal(9,6) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `places`;
CREATE TABLE `places` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`map_id` int(10) unsigned NOT NULL,
`lat` decimal(8,6) NOT NULL,
`lng` decimal(9,6) NOT NULL,
PRIMARY KEY (`id`),
KEY `map_id` (`map_id`),
CONSTRAINT `places_map_id` FOREIGN KEY (`map_id`) REFERENCES `maps` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;