diff --git a/scripts/ulogger.mysql b/scripts/ulogger.mysql index 2e41c12..09f228d 100644 --- a/scripts/ulogger.mysql +++ b/scripts/ulogger.mysql @@ -5,6 +5,17 @@ CREATE DATABASE IF NOT EXISTS `ulogger` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE `ulogger`; +-- -------------------------------------------------------- + +-- +-- Drop tables if exist +-- + +DROP TABLE IF EXISTS `positions`; +DROP TABLE IF EXISTS `tracks`; +DROP TABLE IF EXISTS `users`; +DROP TABLE IF EXISTS `config`; +DROP TABLE IF EXISTS `ol_layers`; -- -------------------------------------------------------- @@ -12,7 +23,6 @@ USE `ulogger`; -- Table structure for table `users` -- -DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `login` varchar(15) CHARACTER SET latin1 NOT NULL UNIQUE, @@ -26,7 +36,6 @@ CREATE TABLE `users` ( -- Table structure for table `tracks` -- -DROP TABLE IF EXISTS `tracks`; CREATE TABLE `tracks` ( `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `user_id` int(11) NOT NULL, @@ -42,7 +51,6 @@ CREATE TABLE `tracks` ( -- Table structure for table `positions` -- -DROP TABLE IF EXISTS `positions`; CREATE TABLE `positions` ( `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -69,7 +77,6 @@ CREATE TABLE `positions` ( -- Table structure for table `config` -- -DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `name` varchar(20) PRIMARY KEY, `value` tinyblob NOT NULL @@ -106,7 +113,6 @@ INSERT INTO `config` (`name`, `value`) VALUES -- Table structure for table `ol_layers` -- -DROP TABLE IF EXISTS `ol_layers`; CREATE TABLE `ol_layers` ( `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` varchar(50) NOT NULL, @@ -132,4 +138,4 @@ INSERT INTO `ol_layers` (`id`, `name`, `url`, `priority`) VALUES -- Uncomment if needed -- -- INSERT INTO `users` (`id`, `login`, `password`, `admin`) VALUES --- (1, 'admin', '$2y$10$7OvZrKgonVZM9lkzrTbiou.CVhO3HjPk5y0W9L68fVwPs/osBRIMq', TRUE); \ No newline at end of file +-- (1, 'admin', '$2y$10$7OvZrKgonVZM9lkzrTbiou.CVhO3HjPk5y0W9L68fVwPs/osBRIMq', TRUE); diff --git a/scripts/ulogger.pgsql b/scripts/ulogger.pgsql index 6300830..8014775 100644 --- a/scripts/ulogger.pgsql +++ b/scripts/ulogger.pgsql @@ -5,6 +5,17 @@ CREATE DATABASE ulogger WITH ENCODING='UTF8' LC_COLLATE = 'en_US.utf-8' LC_CTYPE = 'en_US.utf-8'; \connect ulogger; +-- -------------------------------------------------------- + +-- +-- Drop tables if exist +-- + +DROP TABLE IF EXISTS positions; +DROP TABLE IF EXISTS tracks; +DROP TABLE IF EXISTS users; +DROP TABLE IF EXISTS config; +DROP TABLE IF EXISTS ol_layers; -- -------------------------------------------------------- @@ -12,7 +23,6 @@ CREATE DATABASE ulogger WITH ENCODING='UTF8' LC_COLLATE = 'en_US.utf-8' LC_CTYPE -- Table structure for table `users` -- -DROP TABLE IF EXISTS users; CREATE TABLE users ( id serial PRIMARY KEY, login varchar(15) NOT NULL UNIQUE, @@ -26,7 +36,6 @@ CREATE TABLE users ( -- Table structure for table `tracks` -- -DROP TABLE IF EXISTS tracks; CREATE TABLE tracks ( id serial PRIMARY KEY, user_id int NOT NULL, @@ -43,7 +52,6 @@ CREATE INDEX idx_user_id ON tracks(user_id); -- Table structure for table `positions` -- -DROP TABLE IF EXISTS positions; CREATE TABLE positions ( id serial PRIMARY KEY, time timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -71,7 +79,6 @@ CREATE INDEX idx_puser_id ON positions(user_id); -- Table structure for table `config` -- -DROP TABLE IF EXISTS config; CREATE TABLE config ( name varchar(20) PRIMARY KEY, value bytea NOT NULL @@ -108,8 +115,6 @@ INSERT INTO config (name, value) VALUES -- Table structure for table `ol_layers` -- -DROP TABLE IF EXISTS ol_layers; - CREATE TABLE ol_layers ( id serial PRIMARY KEY, name varchar(50) NOT NULL, @@ -135,4 +140,4 @@ INSERT INTO ol_layers (id, name, url, priority) VALUES -- Uncomment if needed -- -- INSERT INTO users (id, login, password, admin) VALUES --- (1, 'admin', '$2y$10$7OvZrKgonVZM9lkzrTbiou.CVhO3HjPk5y0W9L68fVwPs/osBRIMq', TRUE); \ No newline at end of file +-- (1, 'admin', '$2y$10$7OvZrKgonVZM9lkzrTbiou.CVhO3HjPk5y0W9L68fVwPs/osBRIMq', TRUE); diff --git a/scripts/ulogger.sqlite b/scripts/ulogger.sqlite index 855df21..220f342 100644 --- a/scripts/ulogger.sqlite +++ b/scripts/ulogger.sqlite @@ -2,6 +2,17 @@ -- Database: `ulogger` -- +-- -------------------------------------------------------- + +-- +-- Drop tables if exist +-- + +DROP TABLE IF EXISTS `positions`; +DROP TABLE IF EXISTS `tracks`; +DROP TABLE IF EXISTS `users`; +DROP TABLE IF EXISTS `config`; +DROP TABLE IF EXISTS `ol_layers`; -- -------------------------------------------------------- @@ -9,7 +20,6 @@ -- Table structure for table `users` -- -DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` integer PRIMARY KEY AUTOINCREMENT, `login` varchar(15) NOT NULL UNIQUE, @@ -23,7 +33,6 @@ CREATE TABLE `users` ( -- Table structure for table `tracks` -- -DROP TABLE IF EXISTS `tracks`; CREATE TABLE `tracks` ( `id` integer PRIMARY KEY AUTOINCREMENT, `user_id` integer NOT NULL, @@ -39,7 +48,6 @@ CREATE INDEX `idx_user_id` ON `tracks`(`user_id`); -- Table structure for table `positions` -- -DROP TABLE IF EXISTS `positions`; CREATE TABLE `positions` ( `id` integer PRIMARY KEY AUTOINCREMENT, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -66,7 +74,6 @@ CREATE INDEX `idx_puser_id` ON `positions`(`user_id`); -- Table structure for table `config` -- -DROP TABLE IF EXISTS `config`; CREATE TABLE `config` ( `name` varchar(20) PRIMARY KEY, `value` tinyblob NOT NULL @@ -103,7 +110,6 @@ INSERT INTO `config` (`name`, `value`) VALUES -- Table structure for table `ol_layers` -- -DROP TABLE IF EXISTS `ol_layers`; CREATE TABLE `ol_layers` ( `id` integer PRIMARY KEY AUTOINCREMENT, `name` varchar(50) NOT NULL,