From 2c1bfab10903895ece9644bc095597aaef2a75e8 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 14 Aug 2018 13:23:53 +0300 Subject: Message editing API --- .../db/migration/V1.1__Add updated_at field.sql | 2 ++ juick-server/src/main/resources/schema.sql | 23 +++++++++++++++++++--- juick-server/src/main/resources/update.sql | 12 ----------- 3 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 juick-server/src/main/resources/db/migration/V1.1__Add updated_at field.sql delete mode 100644 juick-server/src/main/resources/update.sql (limited to 'juick-server/src/main/resources') diff --git a/juick-server/src/main/resources/db/migration/V1.1__Add updated_at field.sql b/juick-server/src/main/resources/db/migration/V1.1__Add updated_at field.sql new file mode 100644 index 00000000..dac179b1 --- /dev/null +++ b/juick-server/src/main/resources/db/migration/V1.1__Add updated_at field.sql @@ -0,0 +1,2 @@ +ALTER TABLE messages_txt ADD COLUMN updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE replies ADD COLUMN updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP; diff --git a/juick-server/src/main/resources/schema.sql b/juick-server/src/main/resources/schema.sql index 296fd486..851b764b 100644 --- a/juick-server/src/main/resources/schema.sql +++ b/juick-server/src/main/resources/schema.sql @@ -326,7 +326,7 @@ CREATE TABLE IF NOT EXISTS `messages` ( `message_id` int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, `user_id` int(10) unsigned NOT NULL, `lang` enum('en','ru','fr','fa','__') NOT NULL DEFAULT '__', - `ts` timestamp(9) NOT NULL DEFAULT CURRENT_TIMESTAMP, + `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `replies` smallint(5) unsigned NOT NULL DEFAULT '0', `maxreplyid` smallint(5) unsigned NOT NULL DEFAULT '0', `privacy` tinyint(4) NOT NULL DEFAULT '1', @@ -338,7 +338,7 @@ CREATE TABLE IF NOT EXISTS `messages` ( `popular` tinyint(4) NOT NULL DEFAULT '0', `hidden` tinyint(3) unsigned NOT NULL DEFAULT '0', `likes` smallint(6) NOT NULL DEFAULT '0', - `updated` timestamp(9) NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (`user_id`) references users(id) ); CREATE TABLE IF NOT EXISTS `pm_inroster` ( @@ -376,4 +376,21 @@ CREATE TABLE IF NOT EXISTS `wl_users` ( `user_id` int(10) unsigned NOT NULL, `wl_user_id` int(10) unsigned NOT NULL, PRIMARY KEY (`user_id`,`wl_user_id`) -); \ No newline at end of file +); + +CREATE CACHED TABLE PUBLIC."flyway_schema_history" ( + "installed_rank" INT NOT NULL, + "version" VARCHAR(50), + "description" VARCHAR(200) NOT NULL, + "type" VARCHAR(20) NOT NULL, + "script" VARCHAR(1000) NOT NULL, + "checksum" INT, + "installed_by" VARCHAR(100) NOT NULL, + "installed_on" TIMESTAMP DEFAULT CURRENT_TIMESTAMP() NOT NULL, + "execution_time" INT NOT NULL, + "success" BOOLEAN NOT NULL +); +ALTER TABLE PUBLIC."flyway_schema_history" ADD CONSTRAINT PUBLIC."flyway_schema_history_pk" PRIMARY KEY("installed_rank"); +-- 1 +/- SELECT COUNT(*) FROM PUBLIC."flyway_schema_history"; +INSERT INTO PUBLIC."flyway_schema_history"("installed_rank", "version", "description", "type", "script", "checksum", "installed_by", "installed_on", "execution_time", "success") VALUES +(1, '1', '<< Flyway Baseline >>', 'BASELINE', '<< Flyway Baseline >>', NULL, 'SA', TIMESTAMP '2018-08-14 13:05:13.724', 0, TRUE); \ No newline at end of file diff --git a/juick-server/src/main/resources/update.sql b/juick-server/src/main/resources/update.sql deleted file mode 100644 index 13a62c3d..00000000 --- a/juick-server/src/main/resources/update.sql +++ /dev/null @@ -1,12 +0,0 @@ --- if version table not exists set up version = 0; -update version set version = 0; - -DROP TABLE IF EXISTS `version`; - -CREATE TABLE `version` ( - `version` bigint NOT NULL -); - -insert into version values (0); - -update version set version = 1; \ No newline at end of file -- cgit v1.2.3