aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-22 01:44:15 +0300
committerGravatar Vitaly Takmazov2022-12-22 01:44:32 +0300
commit56afc659e9e8e9b22ece74d5733e718f882da783 (patch)
treef61f201b07fd80642e36751bd59bee184627599d
parentc91692786f3688a8b98d34d9ca1f0c7874f9f0d3 (diff)
h2: baseline to 1.22
-rw-r--r--src/main/resources/db/specific/h2/V1.00__initial_schema.sql380
-rw-r--r--src/main/resources/db/specific/h2/V1.10__favorites_user_uri.sql3
-rw-r--r--src/main/resources/db/specific/h2/V1.11__increase pm timestamp precision.sql1
-rw-r--r--src/main/resources/db/specific/h2/V1.12__drop unused tables.sql5
-rw-r--r--src/main/resources/db/specific/h2/V1.13__drop unused tables.sql5
-rw-r--r--src/main/resources/db/specific/h2/V1.14__drop broken pm_streams.sql1
-rw-r--r--src/main/resources/db/specific/h2/V1.15__drop unused columns add ts for some tables.sql4
-rw-r--r--src/main/resources/db/specific/h2/V1.16__last seen.sql2
-rw-r--r--src/main/resources/db/specific/h2/V1.17__drop tags column.sql1
-rw-r--r--src/main/resources/db/specific/h2/V1.18__increase messages and replies timestamp precision.sql5
-rw-r--r--src/main/resources/db/specific/h2/V1.19__messages_properties.sql6
-rw-r--r--src/main/resources/db/specific/h2/V1.1__Add updated_at field.sql2
-rw-r--r--src/main/resources/db/specific/h2/V1.20__reply id in messages_properties.sql1
-rw-r--r--src/main/resources/db/specific/h2/V1.21__recreate messages_properties with correct index.sql8
-rw-r--r--src/main/resources/db/specific/h2/V1.22__increase updated_at precision.sql2
-rw-r--r--src/main/resources/db/specific/h2/V1.22__schema.sql373
-rw-r--r--src/main/resources/db/specific/h2/V1.24__fix_lastmessage.sql3
-rw-r--r--src/main/resources/db/specific/h2/V1.25__update_tokens_size.sql6
-rw-r--r--src/main/resources/db/specific/h2/V1.2__Drop telegram_chats.sql2
-rw-r--r--src/main/resources/db/specific/h2/V1.3__Nullable user_id column in auth table.sql1
-rw-r--r--src/main/resources/db/specific/h2/V1.4__ActivityPub followers.sql7
-rw-r--r--src/main/resources/db/specific/h2/V1.5__Drop acct index.sql6
-rw-r--r--src/main/resources/db/specific/h2/V1.6__user_uri.sql1
-rw-r--r--src/main/resources/db/specific/h2/V1.7__reply_uri.sql1
-rw-r--r--src/main/resources/db/specific/h2/V1.8__html reply.sql1
-rw-r--r--src/main/resources/db/specific/h2/V1.9__reply_uri_index.sql1
26 files changed, 378 insertions, 450 deletions
diff --git a/src/main/resources/db/specific/h2/V1.00__initial_schema.sql b/src/main/resources/db/specific/h2/V1.00__initial_schema.sql
deleted file mode 100644
index e25e3fed..00000000
--- a/src/main/resources/db/specific/h2/V1.00__initial_schema.sql
+++ /dev/null
@@ -1,380 +0,0 @@
-SET DB_CLOSE_ON_EXIT TRUE;
-SET MODE=MYSQL;
-
-CREATE TABLE IF NOT EXISTS `android` (
- `user_id` int(10) unsigned NOT NULL,
- `regid` char(255) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
-);
-CREATE TABLE IF NOT EXISTS `auth` (
- `user_id` int(10) unsigned NOT NULL,
- `protocol` enum('xmpp','email','sms') NOT NULL,
- `account` char(64) NOT NULL,
- `authcode` char(8) NOT NULL
-);
-CREATE TABLE IF NOT EXISTS `bl_tags` (
- `user_id` int(10) unsigned NOT NULL,
- `tag_id` int(10) unsigned NOT NULL
-);
-CREATE TABLE IF NOT EXISTS `bl_users` (
- `user_id` int(10) unsigned NOT NULL,
- `bl_user_id` int(10) unsigned NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`user_id`,`bl_user_id`)
-);
-CREATE TABLE IF NOT EXISTS `facebook` (
- `user_id` int(10) unsigned DEFAULT NULL,
- `fb_id` bigint(20) unsigned NULL,
- `loginhash` char(36) DEFAULT NULL,
- `access_token` char(255) DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `fb_name` char(64) NULL,
- `fb_link` char(255) NULL,
- `crosspost` tinyint(1) unsigned NOT NULL DEFAULT '1'
-);
-
-CREATE TABLE IF NOT EXISTS `reactions` (
- `like_id` int(10) unsigned NOT NULL,
- `description` varchar (100) NOT NULL
-);
-CREATE TABLE IF NOT EXISTS `favorites` (
- `user_id` int(10) unsigned NOT NULL,
- `message_id` int(10) unsigned NOT NULL,
- `ts` datetime NOT NULL,
- `like_id` int(10),
- foreign key (like_id) references reactions(like_id)
-);
-
-
-
-CREATE TABLE IF NOT EXISTS `friends_facebook` (
- `user_id` int(10) unsigned NOT NULL,
- `friend_id` bigint(20) unsigned NOT NULL,
- UNIQUE KEY `user_id` (`user_id`,`friend_id`)
-);
-CREATE TABLE IF NOT EXISTS `images` (
- `mid` int(10) unsigned NOT NULL,
- `rid` int(10) unsigned NOT NULL,
- `thumb` int(10) unsigned NOT NULL,
- `small` int(10) unsigned NOT NULL,
- `medium` int(10) unsigned NOT NULL,
- `height` int(10) unsigned NOT NULL,
- `width` int(10) unsigned NOT NULL,
- PRIMARY KEY (`mid`,`rid`)
-);
-
-CREATE TABLE IF NOT EXISTS `mail` (
- `user_id` int(10) unsigned NOT NULL,
- `hash` char(16) NOT NULL,
- PRIMARY KEY (`user_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `meon` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `user_id` int(10) unsigned NOT NULL,
- `link` char(255) NOT NULL,
- `name` char(32) NOT NULL,
- `ico` smallint(5) unsigned DEFAULT NULL,
- PRIMARY KEY (`id`)
-);
-
-
-
-CREATE TABLE IF NOT EXISTS `messages_access` (
- `message_id` int(10) unsigned NOT NULL,
- `user_id` int(10) unsigned NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `messages_tags` (
- `message_id` int(10) unsigned NOT NULL,
- `tag_id` int(10) unsigned NOT NULL,
- UNIQUE KEY `message_id_2` (`message_id`,`tag_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `messages_txt` (
- `message_id` int(10) unsigned NOT NULL,
- `tags` varchar(255) DEFAULT NULL,
- `repliesby` varchar(96) DEFAULT NULL,
- `txt` mediumtext NOT NULL,
- PRIMARY KEY (`message_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `messages_votes` (
- `message_id` int(10) unsigned NOT NULL,
- `user_id` int(10) unsigned NOT NULL,
- `vote` tinyint(4) NOT NULL DEFAULT '1',
- UNIQUE KEY `message_id` (`message_id`,`user_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `messenger` (
- `user_id` int(10) unsigned DEFAULT NULL,
- `sender_id` bigint(20) NOT NULL,
- `display_name` char(64) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `loginhash` char(36) DEFAULT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `places` (
- `place_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `lat` decimal(10,7) NOT NULL,
- `lon` decimal(10,7) NOT NULL,
- `name` char(64) NOT NULL,
- `descr` char(255) DEFAULT NULL,
- `url` char(128) DEFAULT NULL,
- `user_id` int(10) unsigned NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`place_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `places_tags` (
- `place_id` int(10) unsigned NOT NULL,
- `tag_id` int(10) unsigned NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `pm` (
- `user_id` int(10) unsigned NOT NULL,
- `user_id_to` int(10) unsigned NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `txt` text NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `pm_streams` (
- `user_id` int(10) unsigned NOT NULL,
- `user_id_to` int(10) unsigned NOT NULL,
- `lastmessage` datetime NOT NULL,
- `lastview` datetime DEFAULT NULL,
- `unread` smallint(5) unsigned NOT NULL DEFAULT '0',
- UNIQUE KEY (`user_id`,`user_id_to`)
-);
-
-CREATE TABLE IF NOT EXISTS `presence` (
- `user_id` int(10) unsigned NOT NULL,
- `jid` char(64) DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- UNIQUE KEY (`jid`)
-);
-
-CREATE TABLE IF NOT EXISTS `replies` (
- `message_id` int(10) unsigned NOT NULL,
- `reply_id` smallint(5) unsigned NOT NULL,
- `user_id` int(10) unsigned NOT NULL,
- `replyto` smallint(5) unsigned NOT NULL DEFAULT '0',
- `ts` timestamp(9) NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `attach` nchar(3) check (attach in ('jpg', 'mp4', 'png')),
- `txt` mediumtext NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `subscr_messages` (
- `message_id` int(10) unsigned NOT NULL,
- `suser_id` int(10) unsigned NOT NULL,
- `last_read_rid` smallint(5) unsigned NOT NULL DEFAULT '0',
- UNIQUE KEY (`message_id`,`suser_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `subscr_tags` (
- `tag_id` int(10) unsigned NOT NULL,
- `suser_id` int(10) unsigned NOT NULL,
- UNIQUE KEY (`tag_id`,`suser_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `subscr_users` (
- `user_id` int(10) unsigned NOT NULL,
- `suser_id` int(10) unsigned NOT NULL,
- `jid` char(64) DEFAULT NULL,
- `active` bit(1) NOT NULL DEFAULT TRUE,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- UNIQUE KEY (`user_id`,`suser_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `tags` (
- `tag_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `synonym_id` int(10) unsigned DEFAULT NULL,
- `name` varchar_ignorecase(70) DEFAULT NULL,
- `top` tinyint(1) unsigned NOT NULL DEFAULT '0',
- `noindex` tinyint(1) unsigned NOT NULL DEFAULT '0',
- `stat_messages` int(10) unsigned NOT NULL DEFAULT '0',
- `stat_users` smallint(5) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`tag_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `tags_ignore` (
- `tag_id` int(10) unsigned NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `tags_synonyms` (
- `name` char(64) NOT NULL,
- `changeto` char(64) NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `telegram` (
- `user_id` int(10) unsigned DEFAULT NULL,
- `tg_id` bigint(20) NOT NULL,
- `tg_name` char(64) DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `loginhash` char(36) DEFAULT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `telegram_chats` (
- `chat_id` bigint(20) DEFAULT NULL,
- UNIQUE KEY `chat_id` (`chat_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `top_ignore_messages` (
- `message_id` int(10) unsigned NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `top_ignore_tags` (
- `tag_id` int(10) unsigned NOT NULL,
- PRIMARY KEY (`tag_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `top_ignore_users` (
- `user_id` int(10) unsigned NOT NULL,
- PRIMARY KEY (`user_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `twitter` (
- `user_id` int(10) unsigned NOT NULL,
- `access_token` char(64) NOT NULL,
- `access_token_secret` char(64) NOT NULL,
- `uname` char(64) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `crosspost` tinyint(1) unsigned NOT NULL DEFAULT '1',
- PRIMARY KEY (`user_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `useroptions` (
- `user_id` int(10) unsigned NOT NULL,
- `jnotify` tinyint(1) NOT NULL DEFAULT '1',
- `subscr_active` tinyint(1) NOT NULL DEFAULT '1',
- `off_ts` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `xmppxhtml` tinyint(1) NOT NULL DEFAULT '0',
- `subscr_notify` tinyint(1) NOT NULL DEFAULT '1',
- `recommendations` tinyint(1) NOT NULL DEFAULT '1',
- `privacy_view` tinyint(1) NOT NULL DEFAULT '1',
- `privacy_reply` tinyint(1) NOT NULL DEFAULT '1',
- `privacy_pm` tinyint(1) NOT NULL DEFAULT '1',
- `repliesview` tinyint(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`user_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `users` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT(0),
- `nick` char(64) NOT NULL,
- `passw` char(32) NOT NULL,
- `lang` enum('en','ru','fr','fa','__') NOT NULL DEFAULT '__',
- `banned` tinyint(3) unsigned NOT NULL DEFAULT '0',
- `lastmessage` timestamp(9) NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `lastpm` int(11) NOT NULL DEFAULT '0',
- `lastphoto` int(11) NOT NULL DEFAULT '0',
- `karma` smallint(6) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- UNIQUE KEY `nick` (`nick`)
-);
-
-CREATE TABLE IF NOT EXISTS `users_refs` (
- `user_id` int(10) unsigned NOT NULL,
- `ref` int(10) unsigned NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `users_subscr` (
- `user_id` int(10) unsigned NOT NULL,
- `cnt` smallint(5) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`user_id`)
-);
-
-CREATE TABLE IF NOT EXISTS `usersinfo` (
- `user_id` int(10) unsigned NOT NULL,
- `jid` char(32) DEFAULT NULL,
- `fullname` char(32) DEFAULT NULL,
- `country` char(32) DEFAULT NULL,
- `url` char(64) DEFAULT NULL,
- `gender` char(32) DEFAULT NULL,
- `bday` char(10) DEFAULT NULL,
- `descr` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`user_id`)
-);
-CREATE TABLE IF NOT EXISTS `emails` (
- `user_id` int(10) unsigned NOT NULL,
- `email` char(64) NOT NULL PRIMARY KEY,
- `subscr_hour` tinyint(4) DEFAULT NULL,
- foreign key (user_id) references users(id)
-);
-CREATE TABLE IF NOT EXISTS `ios` (
- `user_id` int(10) unsigned NOT NULL,
- `token` char(64) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- UNIQUE KEY `token` (`token`),
- foreign key (user_id) references users(id)
-);
-
-CREATE TABLE IF NOT EXISTS `jids` (
- `user_id` int(10) unsigned DEFAULT NULL,
- `jid` char(64) NOT NULL,
- `active` tinyint(1) NOT NULL DEFAULT '1',
- `loginhash` char(36) DEFAULT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- UNIQUE KEY `jid` (`jid`),
- foreign key (user_id) references users(id)
-);
-
-CREATE TABLE IF NOT EXISTS `logins` (
- `user_id` int(10) unsigned NOT NULL,
- `hash` char(16) NOT NULL,
- UNIQUE KEY (`user_id`)
-);
-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 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',
- `readonly` tinyint(1) NOT NULL DEFAULT '0',
- `attach` nchar(3) check (attach in ('jpg', 'mp4', 'png')),
- `place_id` int(10) unsigned DEFAULT NULL,
- `lat` decimal(10,7) DEFAULT NULL,
- `lon` decimal(10,7) DEFAULT NULL,
- `popular` tinyint(4) NOT NULL DEFAULT '0',
- `hidden` tinyint(3) unsigned NOT NULL DEFAULT '0',
- `likes` smallint(6) NOT NULL DEFAULT '0',
- `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- FOREIGN KEY (`user_id`) references users(id)
-);
-CREATE TABLE IF NOT EXISTS `pm_inroster` (
- `user_id` int(10) unsigned NOT NULL,
- `jid` char(64) NOT NULL,
- UNIQUE KEY (`user_id`,`jid`),
- FOREIGN KEY (`user_id`) references users(id)
-);
-
-CREATE TABLE IF NOT EXISTS `version` (
- `version` bigint(20) NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS `vk` (
- `user_id` int(10) unsigned DEFAULT NULL,
- `vk_id` bigint(20) NOT NULL,
- `loginhash` char(36) DEFAULT NULL,
- `access_token` char(128) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `vk_name` char(64) NOT NULL,
- `vk_link` char(64) NOT NULL,
- `crosspost` bit(1) unsigned NOT NULL DEFAULT FALSE,
- FOREIGN KEY (`user_id`) references users(id)
-);
-
-CREATE TABLE IF NOT EXISTS `winphone` (
- `user_id` int(10) unsigned NOT NULL,
- `url` char(255) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- UNIQUE KEY (`url`),
- FOREIGN KEY (`user_id`) references users(id)
-);
-
-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`)
-);
diff --git a/src/main/resources/db/specific/h2/V1.10__favorites_user_uri.sql b/src/main/resources/db/specific/h2/V1.10__favorites_user_uri.sql
deleted file mode 100644
index 8f382398..00000000
--- a/src/main/resources/db/specific/h2/V1.10__favorites_user_uri.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-ALTER TABLE favorites ADD COLUMN user_uri char(255) DEFAULT NULL;
-UPDATE favorites SET user_uri='' WHERE user_uri IS NULL;
-ALTER TABLE favorites MODIFY COLUMN user_uri char(255) NOT NULL DEFAULT ''; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.11__increase pm timestamp precision.sql b/src/main/resources/db/specific/h2/V1.11__increase pm timestamp precision.sql
deleted file mode 100644
index e83eb621..00000000
--- a/src/main/resources/db/specific/h2/V1.11__increase pm timestamp precision.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE pm MODIFY COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.12__drop unused tables.sql b/src/main/resources/db/specific/h2/V1.12__drop unused tables.sql
deleted file mode 100644
index 1599f5f6..00000000
--- a/src/main/resources/db/specific/h2/V1.12__drop unused tables.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-DROP TABLE IF EXISTS messages_votes;
-DROP TABLE IF EXISTS reader_links;
-DROP TABLE IF EXISTS reader_rss;
-DROP TABLE IF EXISTS captcha;
-DROP TABLE IF EXISTS captchaimg; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.13__drop unused tables.sql b/src/main/resources/db/specific/h2/V1.13__drop unused tables.sql
deleted file mode 100644
index c35fc92c..00000000
--- a/src/main/resources/db/specific/h2/V1.13__drop unused tables.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-DROP TABLE IF EXISTS ads_messages;
-DROP TABLE IF EXISTS ads_messages_log;
-DROP TABLE IF EXISTS presence;
-DROP TABLE IF EXISTS friends_facebook;
-DROP TABLE IF EXISTS users_refs; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.14__drop broken pm_streams.sql b/src/main/resources/db/specific/h2/V1.14__drop broken pm_streams.sql
deleted file mode 100644
index 448c5ce2..00000000
--- a/src/main/resources/db/specific/h2/V1.14__drop broken pm_streams.sql
+++ /dev/null
@@ -1 +0,0 @@
-DROP TABLE IF EXISTS pm_streams; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.15__drop unused columns add ts for some tables.sql b/src/main/resources/db/specific/h2/V1.15__drop unused columns add ts for some tables.sql
deleted file mode 100644
index 2350bff2..00000000
--- a/src/main/resources/db/specific/h2/V1.15__drop unused columns add ts for some tables.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-ALTER TABLE subscr_users DROP COLUMN jid;
-ALTER TABLE subscr_users DROP COLUMN active;
-ALTER TABLE auth ADD COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-ALTER TABLE mail ADD COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.16__last seen.sql b/src/main/resources/db/specific/h2/V1.16__last seen.sql
deleted file mode 100644
index 52ca4e90..00000000
--- a/src/main/resources/db/specific/h2/V1.16__last seen.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-ALTER TABLE users ADD COLUMN last_seen timestamp(6) NULL;
-UPDATE users SET last_seen=lastmessage; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.17__drop tags column.sql b/src/main/resources/db/specific/h2/V1.17__drop tags column.sql
deleted file mode 100644
index ebb2d9a6..00000000
--- a/src/main/resources/db/specific/h2/V1.17__drop tags column.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE messages_txt DROP COLUMN tags; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.18__increase messages and replies timestamp precision.sql b/src/main/resources/db/specific/h2/V1.18__increase messages and replies timestamp precision.sql
deleted file mode 100644
index 5b298c46..00000000
--- a/src/main/resources/db/specific/h2/V1.18__increase messages and replies timestamp precision.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-ALTER TABLE replies MODIFY COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-ALTER TABLE messages MODIFY COLUMN ts timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-ALTER TABLE messages MODIFY COLUMN updated timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-ALTER TABLE messages_txt MODIFY COLUMN updated_at timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-ALTER TABLE users MODIFY COLUMN lastmessage timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
diff --git a/src/main/resources/db/specific/h2/V1.19__messages_properties.sql b/src/main/resources/db/specific/h2/V1.19__messages_properties.sql
deleted file mode 100644
index 2bb3baf2..00000000
--- a/src/main/resources/db/specific/h2/V1.19__messages_properties.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE messages_properties (
- message_id int(10) unsigned NOT NULL,
- property_key varchar(255) NOT NULL,
- property_value mediumtext NOT NULL,
- UNIQUE KEY message_key(message_id, property_key)
-) \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.1__Add updated_at field.sql b/src/main/resources/db/specific/h2/V1.1__Add updated_at field.sql
deleted file mode 100644
index dac179b1..00000000
--- a/src/main/resources/db/specific/h2/V1.1__Add updated_at field.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-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/src/main/resources/db/specific/h2/V1.20__reply id in messages_properties.sql b/src/main/resources/db/specific/h2/V1.20__reply id in messages_properties.sql
deleted file mode 100644
index 2ca5e018..00000000
--- a/src/main/resources/db/specific/h2/V1.20__reply id in messages_properties.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE messages_properties ADD COLUMN reply_id smallint(5) unsigned NOT NULL \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.21__recreate messages_properties with correct index.sql b/src/main/resources/db/specific/h2/V1.21__recreate messages_properties with correct index.sql
deleted file mode 100644
index 685318af..00000000
--- a/src/main/resources/db/specific/h2/V1.21__recreate messages_properties with correct index.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-DROP TABLE messages_properties;
-CREATE TABLE messages_properties (
- message_id int(10) unsigned NOT NULL,
- reply_id smallint(5) unsigned NOT NULL,
- property_key varchar(255) NOT NULL,
- property_value mediumtext NOT NULL,
- UNIQUE KEY message_key(message_id, reply_id, property_key)
-) \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.22__increase updated_at precision.sql b/src/main/resources/db/specific/h2/V1.22__increase updated_at precision.sql
deleted file mode 100644
index 22034ea2..00000000
--- a/src/main/resources/db/specific/h2/V1.22__increase updated_at precision.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-ALTER TABLE replies MODIFY COLUMN updated_at timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP;
-ALTER TABLE messages_txt MODIFY COLUMN updated_at timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.22__schema.sql b/src/main/resources/db/specific/h2/V1.22__schema.sql
new file mode 100644
index 00000000..0bfbc5c8
--- /dev/null
+++ b/src/main/resources/db/specific/h2/V1.22__schema.sql
@@ -0,0 +1,373 @@
+-- H2 2.1.214;
+SET DB_CLOSE_DELAY -1;
+;
+
+CREATE MEMORY TABLE "PUBLIC"."ANDROID"(
+ "USER_ID" INTEGER NOT NULL,
+ "REGID" CHARACTER(255) NOT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.ANDROID;
+CREATE MEMORY TABLE "PUBLIC"."MAIL"(
+ "USER_ID" INTEGER NOT NULL,
+ "HASH" CHARACTER(16) NOT NULL,
+ "TS" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+ALTER TABLE "PUBLIC"."MAIL" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_23" PRIMARY KEY("USER_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.MAIL;
+CREATE MEMORY TABLE "PUBLIC"."BL_TAGS"(
+ "USER_ID" INTEGER NOT NULL,
+ "TAG_ID" INTEGER NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.BL_TAGS;
+CREATE MEMORY TABLE "PUBLIC"."BL_USERS"(
+ "USER_ID" INTEGER NOT NULL,
+ "BL_USER_ID" INTEGER NOT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+ALTER TABLE "PUBLIC"."BL_USERS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_2" PRIMARY KEY("USER_ID", "BL_USER_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.BL_USERS;
+CREATE MEMORY TABLE "PUBLIC"."REACTIONS"(
+ "LIKE_ID" INTEGER NOT NULL,
+ "DESCRIPTION" CHARACTER VARYING(100) NOT NULL
+);
+CREATE MEMORY TABLE "PUBLIC"."FAVORITES"(
+ "USER_ID" INTEGER NOT NULL,
+ "MESSAGE_ID" INTEGER NOT NULL,
+ "TS" TIMESTAMP NOT NULL,
+ "LIKE_ID" INTEGER,
+ "USER_URI" CHARACTER(255) DEFAULT '' NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.FAVORITES;
+CREATE MEMORY TABLE "PUBLIC"."AUTH"(
+ "USER_ID" INTEGER,
+ "PROTOCOL" ENUM('xmpp', 'email', 'sms') NOT NULL,
+ "ACCOUNT" CHARACTER(64) NOT NULL,
+ "AUTHCODE" CHARACTER(8) NOT NULL,
+ "TS" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.AUTH;
+CREATE MEMORY TABLE "PUBLIC"."IMAGES"(
+ "MID" INTEGER NOT NULL,
+ "RID" INTEGER NOT NULL,
+ "THUMB" INTEGER NOT NULL,
+ "SMALL" INTEGER NOT NULL,
+ "MEDIUM" INTEGER NOT NULL,
+ "HEIGHT" INTEGER NOT NULL,
+ "WIDTH" INTEGER NOT NULL
+);
+ALTER TABLE "PUBLIC"."IMAGES" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_8" PRIMARY KEY("MID", "RID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.IMAGES;
+CREATE MEMORY TABLE "PUBLIC"."MESSAGES_PROPERTIES"(
+ "MESSAGE_ID" INTEGER NOT NULL,
+ "REPLY_ID" SMALLINT NOT NULL,
+ "PROPERTY_KEY" CHARACTER VARYING(255) NOT NULL,
+ "PROPERTY_VALUE" CHARACTER VARYING NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.MESSAGES_PROPERTIES;
+CREATE MEMORY TABLE "PUBLIC"."MEON"(
+ "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) DEFAULT ON NULL NOT NULL,
+ "USER_ID" INTEGER NOT NULL,
+ "LINK" CHARACTER(255) NOT NULL,
+ "NAME" CHARACTER(32) NOT NULL,
+ "ICO" SMALLINT DEFAULT NULL
+);
+ALTER TABLE "PUBLIC"."MEON" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_24" PRIMARY KEY("ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.MEON;
+CREATE MEMORY TABLE "PUBLIC"."MESSAGES_ACCESS"(
+ "MESSAGE_ID" INTEGER NOT NULL,
+ "USER_ID" INTEGER NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.MESSAGES_ACCESS;
+CREATE MEMORY TABLE "PUBLIC"."MESSAGES_TAGS"(
+ "MESSAGE_ID" INTEGER NOT NULL,
+ "TAG_ID" INTEGER NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.MESSAGES_TAGS;
+CREATE MEMORY TABLE "PUBLIC"."USEROPTIONS"(
+ "USER_ID" INTEGER NOT NULL,
+ "JNOTIFY" TINYINT DEFAULT '1' NOT NULL,
+ "SUBSCR_ACTIVE" TINYINT DEFAULT '1' NOT NULL,
+ "XMPPXHTML" TINYINT DEFAULT '0' NOT NULL,
+ "SUBSCR_NOTIFY" TINYINT DEFAULT '1' NOT NULL,
+ "OFF_TS" TIMESTAMP,
+ "RECOMMENDATIONS" TINYINT DEFAULT '1' NOT NULL,
+ "PRIVACY_VIEW" TINYINT DEFAULT '1' NOT NULL,
+ "PRIVACY_REPLY" TINYINT DEFAULT '1' NOT NULL,
+ "PRIVACY_PM" TINYINT DEFAULT '1' NOT NULL,
+ "REPLIESVIEW" TINYINT DEFAULT '0' NOT NULL
+);
+ALTER TABLE "PUBLIC"."USEROPTIONS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_C0" PRIMARY KEY("USER_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.USEROPTIONS;
+CREATE MEMORY TABLE "PUBLIC"."PM"(
+ "USER_ID" INTEGER NOT NULL,
+ "USER_ID_TO" INTEGER NOT NULL,
+ "TS" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "TXT" CHARACTER VARYING NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.PM;
+CREATE MEMORY TABLE "PUBLIC"."FOLLOWERS"(
+ "USER_ID" INTEGER DEFAULT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "ACCT" CHARACTER(64) NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.FOLLOWERS;
+CREATE MEMORY TABLE "PUBLIC"."SUBSCR_USERS"(
+ "USER_ID" INTEGER NOT NULL,
+ "SUSER_ID" INTEGER NOT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.SUBSCR_USERS;
+CREATE MEMORY TABLE "PUBLIC"."MESSENGER"(
+ "USER_ID" INTEGER DEFAULT NULL,
+ "SENDER_ID" BIGINT NOT NULL,
+ "DISPLAY_NAME" CHARACTER(64) NOT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "LOGINHASH" CHARACTER(36) DEFAULT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.MESSENGER;
+CREATE MEMORY TABLE "PUBLIC"."PLACES"(
+ "PLACE_ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) DEFAULT ON NULL NOT NULL,
+ "LAT" DECIMAL(10, 7) NOT NULL,
+ "LON" DECIMAL(10, 7) NOT NULL,
+ "NAME" CHARACTER(64) NOT NULL,
+ "DESCR" CHARACTER(255) DEFAULT NULL,
+ "URL" CHARACTER(128) DEFAULT NULL,
+ "USER_ID" INTEGER NOT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+ALTER TABLE "PUBLIC"."PLACES" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_8C" PRIMARY KEY("PLACE_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.PLACES;
+CREATE MEMORY TABLE "PUBLIC"."PLACES_TAGS"(
+ "PLACE_ID" INTEGER NOT NULL,
+ "TAG_ID" INTEGER NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.PLACES_TAGS;
+CREATE MEMORY TABLE "PUBLIC"."REPLIES"(
+ "MESSAGE_ID" INTEGER NOT NULL,
+ "REPLY_ID" SMALLINT NOT NULL,
+ "USER_ID" INTEGER NOT NULL,
+ "REPLYTO" SMALLINT DEFAULT '0' NOT NULL,
+ "TS" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "ATTACH" CHARACTER(3),
+ "TXT" CHARACTER VARYING NOT NULL,
+ "UPDATED_AT" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "USER_URI" CHARACTER(255) DEFAULT NULL,
+ "REPLY_URI" CHARACTER(255) DEFAULT NULL,
+ "HTML" TINYINT DEFAULT '0' NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.REPLIES;
+CREATE INDEX "PUBLIC"."REPLY_URI_INDEX" ON "PUBLIC"."REPLIES"("REPLY_URI" NULLS FIRST);
+CREATE MEMORY TABLE "PUBLIC"."MESSAGES_TXT"(
+ "MESSAGE_ID" INTEGER NOT NULL,
+ "REPLIESBY" CHARACTER VARYING(96) DEFAULT NULL,
+ "TXT" CHARACTER VARYING NOT NULL,
+ "UPDATED_AT" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+ALTER TABLE "PUBLIC"."MESSAGES_TXT" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_3E" PRIMARY KEY("MESSAGE_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.MESSAGES_TXT;
+CREATE MEMORY TABLE "PUBLIC"."MESSAGES"(
+ "MESSAGE_ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) DEFAULT ON NULL NOT NULL,
+ "USER_ID" INTEGER NOT NULL,
+ "LANG" ENUM('en', 'ru', 'fr', 'fa', '__') DEFAULT '__' NOT NULL,
+ "TS" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "REPLIES" SMALLINT DEFAULT '0' NOT NULL,
+ "MAXREPLYID" SMALLINT DEFAULT '0' NOT NULL,
+ "PRIVACY" TINYINT DEFAULT '1' NOT NULL,
+ "READONLY" TINYINT DEFAULT '0' NOT NULL,
+ "ATTACH" CHARACTER(3),
+ "PLACE_ID" INTEGER DEFAULT NULL,
+ "LAT" DECIMAL(10, 7) DEFAULT NULL,
+ "LON" DECIMAL(10, 7) DEFAULT NULL,
+ "POPULAR" TINYINT DEFAULT '0' NOT NULL,
+ "HIDDEN" TINYINT DEFAULT '0' NOT NULL,
+ "LIKES" SMALLINT DEFAULT '0' NOT NULL,
+ "UPDATED" TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+ALTER TABLE "PUBLIC"."MESSAGES" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_13" PRIMARY KEY("MESSAGE_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.MESSAGES;
+CREATE MEMORY TABLE "PUBLIC"."VK"(
+ "USER_ID" INTEGER DEFAULT NULL,
+ "VK_ID" BIGINT NOT NULL,
+ "LOGINHASH" CHARACTER(36) DEFAULT NULL,
+ "ACCESS_TOKEN" CHARACTER VARYING(64),
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "VK_NAME" CHARACTER(64) NOT NULL,
+ "VK_LINK" CHARACTER(64) NOT NULL,
+ "CROSSPOST" BOOLEAN DEFAULT FALSE NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.VK;
+CREATE MEMORY TABLE "PUBLIC"."SUBSCR_MESSAGES"(
+ "MESSAGE_ID" INTEGER NOT NULL,
+ "SUSER_ID" INTEGER NOT NULL,
+ "LAST_READ_RID" SMALLINT DEFAULT '0' NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.SUBSCR_MESSAGES;
+CREATE MEMORY TABLE "PUBLIC"."SUBSCR_TAGS"(
+ "TAG_ID" INTEGER NOT NULL,
+ "SUSER_ID" INTEGER NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.SUBSCR_TAGS;
+CREATE MEMORY TABLE "PUBLIC"."USERS"(
+ "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0 RESTART WITH 6 MINVALUE 0) DEFAULT ON NULL NOT NULL,
+ "NICK" CHARACTER(64) NOT NULL,
+ "PASSW" CHARACTER(32) NOT NULL,
+ "LANG" ENUM('en', 'ru', 'fr', 'fa', '__') DEFAULT '__' NOT NULL,
+ "BANNED" TINYINT DEFAULT '0' NOT NULL,
+ "LASTMESSAGE" TIMESTAMP(6) NOT NULL,
+ "LASTPM" INTEGER DEFAULT '0' NOT NULL,
+ "LASTPHOTO" INTEGER DEFAULT '0' NOT NULL,
+ "KARMA" SMALLINT DEFAULT '0' NOT NULL,
+ "LAST_SEEN" TIMESTAMP(6)
+);
+ALTER TABLE "PUBLIC"."USERS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_4" PRIMARY KEY("ID");
+CREATE MEMORY TABLE "PUBLIC"."TAGS"(
+ "TAG_ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 RESTART WITH 3) DEFAULT ON NULL NOT NULL,
+ "SYNONYM_ID" INTEGER DEFAULT NULL,
+ "NAME" VARCHAR_IGNORECASE(70) DEFAULT NULL,
+ "TOP" TINYINT DEFAULT '0' NOT NULL,
+ "NOINDEX" TINYINT DEFAULT '0' NOT NULL,
+ "STAT_MESSAGES" INTEGER DEFAULT '0' NOT NULL,
+ "STAT_USERS" SMALLINT DEFAULT '0' NOT NULL
+);
+ALTER TABLE "PUBLIC"."TAGS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_27" PRIMARY KEY("TAG_ID");
+CREATE MEMORY TABLE "PUBLIC"."TAGS_IGNORE"(
+ "TAG_ID" INTEGER NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TAGS_IGNORE;
+CREATE MEMORY TABLE "PUBLIC"."TAGS_SYNONYMS"(
+ "NAME" CHARACTER(64) NOT NULL,
+ "CHANGETO" CHARACTER(64) NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TAGS_SYNONYMS;
+CREATE MEMORY TABLE "PUBLIC"."TELEGRAM"(
+ "USER_ID" INTEGER DEFAULT NULL,
+ "TG_ID" BIGINT NOT NULL,
+ "TG_NAME" CHARACTER(64) DEFAULT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "LOGINHASH" CHARACTER(36) DEFAULT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TELEGRAM;
+CREATE MEMORY TABLE "PUBLIC"."TOP_IGNORE_MESSAGES"(
+ "MESSAGE_ID" INTEGER NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TOP_IGNORE_MESSAGES;
+CREATE MEMORY TABLE "PUBLIC"."TOP_IGNORE_TAGS"(
+ "TAG_ID" INTEGER NOT NULL
+);
+ALTER TABLE "PUBLIC"."TOP_IGNORE_TAGS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_7" PRIMARY KEY("TAG_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TOP_IGNORE_TAGS;
+CREATE MEMORY TABLE "PUBLIC"."TOP_IGNORE_USERS"(
+ "USER_ID" INTEGER NOT NULL
+);
+ALTER TABLE "PUBLIC"."TOP_IGNORE_USERS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_B2" PRIMARY KEY("USER_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TOP_IGNORE_USERS;
+CREATE MEMORY TABLE "PUBLIC"."FACEBOOK"(
+ "USER_ID" INTEGER DEFAULT NULL,
+ "FB_ID" BIGINT,
+ "LOGINHASH" CHARACTER(36) DEFAULT NULL,
+ "ACCESS_TOKEN" CHARACTER VARYING(64),
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "FB_NAME" CHARACTER(64),
+ "FB_LINK" CHARACTER(255),
+ "CROSSPOST" TINYINT DEFAULT '1' NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.FACEBOOK;
+CREATE MEMORY TABLE "PUBLIC"."TWITTER"(
+ "USER_ID" INTEGER NOT NULL,
+ "ACCESS_TOKEN" CHARACTER VARYING(64),
+ "ACCESS_TOKEN_SECRET" CHARACTER(64) NOT NULL,
+ "UNAME" CHARACTER(64) NOT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
+ "CROSSPOST" TINYINT DEFAULT '1' NOT NULL
+);
+ALTER TABLE "PUBLIC"."TWITTER" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_F" PRIMARY KEY("USER_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.TWITTER;
+CREATE MEMORY TABLE "PUBLIC"."USERS_SUBSCR"(
+ "USER_ID" INTEGER NOT NULL,
+ "CNT" SMALLINT DEFAULT '0' NOT NULL
+);
+ALTER TABLE "PUBLIC"."USERS_SUBSCR" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_BB" PRIMARY KEY("USER_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.USERS_SUBSCR;
+CREATE MEMORY TABLE "PUBLIC"."USERSINFO"(
+ "USER_ID" INTEGER NOT NULL,
+ "JID" CHARACTER(32) DEFAULT NULL,
+ "FULLNAME" CHARACTER(32) DEFAULT NULL,
+ "COUNTRY" CHARACTER(32) DEFAULT NULL,
+ "URL" CHARACTER(64) DEFAULT NULL,
+ "GENDER" CHARACTER(32) DEFAULT NULL,
+ "BDAY" CHARACTER(10) DEFAULT NULL,
+ "DESCR" CHARACTER VARYING(255) DEFAULT NULL
+);
+ALTER TABLE "PUBLIC"."USERSINFO" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_BB6" PRIMARY KEY("USER_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.USERSINFO;
+CREATE MEMORY TABLE "PUBLIC"."EMAILS"(
+ "USER_ID" INTEGER NOT NULL,
+ "EMAIL" CHARACTER(64) NOT NULL,
+ "SUBSCR_HOUR" TINYINT DEFAULT NULL
+);
+ALTER TABLE "PUBLIC"."EMAILS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_7A" PRIMARY KEY("EMAIL");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.EMAILS;
+CREATE MEMORY TABLE "PUBLIC"."IOS"(
+ "USER_ID" INTEGER NOT NULL,
+ "TOKEN" CHARACTER(64) NOT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.IOS;
+CREATE MEMORY TABLE "PUBLIC"."JIDS"(
+ "USER_ID" INTEGER DEFAULT NULL,
+ "JID" CHARACTER(64) NOT NULL,
+ "ACTIVE" TINYINT DEFAULT '1' NOT NULL,
+ "LOGINHASH" CHARACTER(36) DEFAULT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.JIDS;
+CREATE MEMORY TABLE "PUBLIC"."LOGINS"(
+ "USER_ID" INTEGER NOT NULL,
+ "HASH" CHARACTER(16) NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.LOGINS;
+CREATE MEMORY TABLE "PUBLIC"."PM_INROSTER"(
+ "USER_ID" INTEGER NOT NULL,
+ "JID" CHARACTER(64) NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.PM_INROSTER;
+CREATE MEMORY TABLE "PUBLIC"."VERSION"(
+ "VERSION" BIGINT NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.VERSION;
+CREATE MEMORY TABLE "PUBLIC"."WINPHONE"(
+ "USER_ID" INTEGER NOT NULL,
+ "URL" CHARACTER(255) NOT NULL,
+ "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
+);
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.WINPHONE;
+CREATE MEMORY TABLE "PUBLIC"."WL_USERS"(
+ "USER_ID" INTEGER NOT NULL,
+ "WL_USER_ID" INTEGER NOT NULL
+);
+ALTER TABLE "PUBLIC"."WL_USERS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_A8" PRIMARY KEY("USER_ID", "WL_USER_ID");
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.WL_USERS;
+ALTER TABLE "PUBLIC"."MESSAGES" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_131" CHECK("ATTACH" IN('jpg', 'mp4', 'png')) NOCHECK;
+ALTER TABLE "PUBLIC"."REPLIES" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_6C" CHECK("ATTACH" IN('jpg', 'mp4', 'png')) NOCHECK;
+ALTER TABLE "PUBLIC"."LOGINS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_86" UNIQUE("USER_ID");
+ALTER TABLE "PUBLIC"."PM_INROSTER" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_5" UNIQUE("USER_ID", "JID");
+ALTER TABLE "PUBLIC"."REACTIONS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_6" UNIQUE("LIKE_ID");
+ALTER TABLE "PUBLIC"."IOS" ADD CONSTRAINT "PUBLIC"."TOKEN" UNIQUE("TOKEN");
+ALTER TABLE "PUBLIC"."SUBSCR_TAGS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_B" UNIQUE("TAG_ID", "SUSER_ID");
+ALTER TABLE "PUBLIC"."SUBSCR_USERS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_C" UNIQUE("USER_ID", "SUSER_ID");
+ALTER TABLE "PUBLIC"."MESSAGES_PROPERTIES" ADD CONSTRAINT "PUBLIC"."MESSAGE_KEY" UNIQUE("MESSAGE_ID", "REPLY_ID", "PROPERTY_KEY");
+ALTER TABLE "PUBLIC"."USERS" ADD CONSTRAINT "PUBLIC"."NICK" UNIQUE("NICK");
+ALTER TABLE "PUBLIC"."MESSAGES_TAGS" ADD CONSTRAINT "PUBLIC"."MESSAGE_ID_2" UNIQUE("MESSAGE_ID", "TAG_ID");
+ALTER TABLE "PUBLIC"."SUBSCR_MESSAGES" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_6D" UNIQUE("MESSAGE_ID", "SUSER_ID");
+ALTER TABLE "PUBLIC"."JIDS" ADD CONSTRAINT "PUBLIC"."JID" UNIQUE("JID");
+ALTER TABLE "PUBLIC"."WINPHONE" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_EC" UNIQUE("URL");
+ALTER TABLE "PUBLIC"."VK" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_A" FOREIGN KEY("USER_ID") REFERENCES "PUBLIC"."USERS"("ID") NOCHECK;
+ALTER TABLE "PUBLIC"."FAVORITES" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_3" FOREIGN KEY("LIKE_ID") REFERENCES "PUBLIC"."REACTIONS"("LIKE_ID") NOCHECK;
+ALTER TABLE "PUBLIC"."IOS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_1" FOREIGN KEY("USER_ID") REFERENCES "PUBLIC"."USERS"("ID") NOCHECK;
+ALTER TABLE "PUBLIC"."MESSAGES" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_131A" FOREIGN KEY("USER_ID") REFERENCES "PUBLIC"."USERS"("ID") NOCHECK;
+ALTER TABLE "PUBLIC"."FOLLOWERS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_D" FOREIGN KEY("USER_ID") REFERENCES "PUBLIC"."USERS"("ID") NOCHECK;
+ALTER TABLE "PUBLIC"."JIDS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_22" FOREIGN KEY("USER_ID") REFERENCES "PUBLIC"."USERS"("ID") NOCHECK;
+ALTER TABLE "PUBLIC"."EMAILS" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_7A1" FOREIGN KEY("USER_ID") REFERENCES "PUBLIC"."USERS"("ID") NOCHECK;
+ALTER TABLE "PUBLIC"."PM_INROSTER" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_54" FOREIGN KEY("USER_ID") REFERENCES "PUBLIC"."USERS"("ID") NOCHECK;
+ALTER TABLE "PUBLIC"."WINPHONE" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_ECD" FOREIGN KEY("USER_ID") REFERENCES "PUBLIC"."USERS"("ID") NOCHECK;
diff --git a/src/main/resources/db/specific/h2/V1.24__fix_lastmessage.sql b/src/main/resources/db/specific/h2/V1.24__fix_lastmessage.sql
index 399abf01..bcca2b50 100644
--- a/src/main/resources/db/specific/h2/V1.24__fix_lastmessage.sql
+++ b/src/main/resources/db/specific/h2/V1.24__fix_lastmessage.sql
@@ -1 +1,2 @@
-ALTER TABLE users MODIFY COLUMN lastmessage TIMESTAMP(6) NULL \ No newline at end of file
+ALTER TABLE users ALTER COLUMN lastmessage SET NULL
+
diff --git a/src/main/resources/db/specific/h2/V1.25__update_tokens_size.sql b/src/main/resources/db/specific/h2/V1.25__update_tokens_size.sql
index 05eefe24..a1c7bbac 100644
--- a/src/main/resources/db/specific/h2/V1.25__update_tokens_size.sql
+++ b/src/main/resources/db/specific/h2/V1.25__update_tokens_size.sql
@@ -1,3 +1,3 @@
-ALTER TABLE vk MODIFY COLUMN access_token VARCHAR(255);
-ALTER TABLE twitter MODIFY COLUMN access_token VARCHAR(255);
-ALTER TABLE facebook MODIFY COLUMN access_token VARCHAR(255); \ No newline at end of file
+ALTER TABLE vk ALTER COLUMN access_token TYPE character varying(255);
+ALTER TABLE twitter ALTER COLUMN access_token TYPE character varying(255);
+ALTER TABLE facebook ALTER COLUMN access_token TYPE character varying(255); \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.2__Drop telegram_chats.sql b/src/main/resources/db/specific/h2/V1.2__Drop telegram_chats.sql
deleted file mode 100644
index c8faee0d..00000000
--- a/src/main/resources/db/specific/h2/V1.2__Drop telegram_chats.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-INSERT INTO telegram(tg_id, tg_name, loginhash) SELECT chat_id AS tg_id, 'Anonymous', UUID() FROM telegram_chats;
-DROP TABLE telegram_chats; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.3__Nullable user_id column in auth table.sql b/src/main/resources/db/specific/h2/V1.3__Nullable user_id column in auth table.sql
deleted file mode 100644
index ced85ade..00000000
--- a/src/main/resources/db/specific/h2/V1.3__Nullable user_id column in auth table.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE auth MODIFY COLUMN user_id int(10) unsigned NULL; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.4__ActivityPub followers.sql b/src/main/resources/db/specific/h2/V1.4__ActivityPub followers.sql
deleted file mode 100644
index 16b39f62..00000000
--- a/src/main/resources/db/specific/h2/V1.4__ActivityPub followers.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE IF NOT EXISTS `followers` (
- `user_id` int(10) unsigned DEFAULT NULL,
- `acct` char(64) NOT NULL,
- `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- UNIQUE KEY `acct` (`acct`),
- foreign key (user_id) references users(id)
-); \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.5__Drop acct index.sql b/src/main/resources/db/specific/h2/V1.5__Drop acct index.sql
deleted file mode 100644
index 58757d88..00000000
--- a/src/main/resources/db/specific/h2/V1.5__Drop acct index.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-ALTER TABLE followers ADD COLUMN `acct_migr` char(64) NOT NULL;
-UPDATE followers SET `acct_migr` = `acct`;
-ALTER TABLE followers DROP COLUMN `acct`;
-ALTER TABLE followers ADD COLUMN `acct` char(64) NOT NULL;
-UPDATE followers SET `acct` = `acct_migr`;
-ALTER TABLE followers DROP COLUMN `acct_migr`; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.6__user_uri.sql b/src/main/resources/db/specific/h2/V1.6__user_uri.sql
deleted file mode 100644
index c302907c..00000000
--- a/src/main/resources/db/specific/h2/V1.6__user_uri.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE replies ADD COLUMN user_uri char(255) DEFAULT NULL; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.7__reply_uri.sql b/src/main/resources/db/specific/h2/V1.7__reply_uri.sql
deleted file mode 100644
index 9ec35485..00000000
--- a/src/main/resources/db/specific/h2/V1.7__reply_uri.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE replies ADD COLUMN reply_uri char(255) DEFAULT NULL; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.8__html reply.sql b/src/main/resources/db/specific/h2/V1.8__html reply.sql
deleted file mode 100644
index 9f939971..00000000
--- a/src/main/resources/db/specific/h2/V1.8__html reply.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE replies ADD COLUMN html tinyint(4) NOT NULL DEFAULT '0'; \ No newline at end of file
diff --git a/src/main/resources/db/specific/h2/V1.9__reply_uri_index.sql b/src/main/resources/db/specific/h2/V1.9__reply_uri_index.sql
deleted file mode 100644
index 0ee3c77f..00000000
--- a/src/main/resources/db/specific/h2/V1.9__reply_uri_index.sql
+++ /dev/null
@@ -1 +0,0 @@
-create index reply_uri_index on replies(reply_uri) \ No newline at end of file