Hi,
I’m wondering if it is a right way
to store locations and positions.
CREATE TABLE `locations` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`parent_id` int unsigned DEFAULT NULL,
`zip` int unsigned DEFAULT NULL,
`np` varchar(5) DEFAULT NULL,
`place` varchar(255) NOT NULL,
`lft` int unsigned NOT NULL,
`rgt` int unsigned NOT NULL,
`has_pos` enum('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `parent_id` (`parent_id`),
KEY `lt` (`lft`),
KEY `rt` (`rgt`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8
CREATE TABLE `positions` (
`location_id` int unsigned NOT NULL,
`latitude` FLOAT(9,6) NOT NULL,
`longitude` FLOAT(9,6) NOT NULL,
PRIMARY KEY (`location_id`) ,
CONSTRAINT `fk_pos_to_loc` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8
Bye.