CREATE TABLE `filling_station` (
  `int_id` int(11) NOT NULL AUTO_INCREMENT,
  `id` varchar(40) NOT NULL,
  `name` text NOT NULL,
  `street` text NOT NULL,
  `place` text NOT NULL,
  `houseNumber` text,
  `postCode` int(11) NOT NULL,
  `brand` text NOT NULL,
  `lat` decimal(8,5) NOT NULL,
  `lng` decimal(8,5) NOT NULL,
  `last_update` datetime DEFAULT NULL,
  `diesel` decimal(10,3) DEFAULT NULL,
  `e5` decimal(10,3) DEFAULT NULL,
  `e10` decimal(10,3) DEFAULT NULL,
  `open` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`int_id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1;

CREATE TABLE `users_fillingstations` (
  `user_id` int(11) DEFAULT NULL,
  `fillingstation_id` int(11) DEFAULT NULL,
  KEY `user_id` (`user_id`),
  KEY `fillingstation_id` (`fillingstation_id`),
  CONSTRAINT `users_fillingstations_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
  CONSTRAINT `users_fillingstations_ibfk_2` FOREIGN KEY (`fillingstation_id`) REFERENCES `filling_station` (`int_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `consumable` ADD COLUMN `ext_id` varchar(255) DEFAULT NULL;
update consumable set ext_id = 'e5' where id = 1;
update consumable set ext_id = 'e10' where id = 34;
update consumable set ext_id = 'diesel' where id = 32;


ALTER TABLE `user` ADD COLUMN `home_lat` decimal(8,5) DEFAULT NULL;
ALTER TABLE `user` ADD COLUMN `home_long` decimal(8,5) DEFAULT NULL;
ALTER TABLE `user` ADD COLUMN `home_zoom` int(11) DEFAULT NULL;

