From 15fbc16291e0a15cf05e9b4477eaf8709833d3a0 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Thu, 22 Dec 2022 02:12:46 +0300
Subject: h2: fix schema and pass tests without compatibility modes

---
 src/main/resources/db/specific/h2/V1.22__schema.sql | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

(limited to 'src/main/resources/db/specific/h2/V1.22__schema.sql')

diff --git a/src/main/resources/db/specific/h2/V1.22__schema.sql b/src/main/resources/db/specific/h2/V1.22__schema.sql
index 0bfbc5c8..83ff7054 100644
--- a/src/main/resources/db/specific/h2/V1.22__schema.sql
+++ b/src/main/resources/db/specific/h2/V1.22__schema.sql
@@ -1,6 +1,5 @@
 -- H2 2.1.214;
 SET DB_CLOSE_DELAY -1;
-;
 
 CREATE MEMORY TABLE "PUBLIC"."ANDROID"(
     "USER_ID" INTEGER NOT NULL,
@@ -36,7 +35,7 @@ CREATE MEMORY TABLE "PUBLIC"."FAVORITES"(
     "MESSAGE_ID" INTEGER NOT NULL,
     "TS" TIMESTAMP NOT NULL,
     "LIKE_ID" INTEGER,
-    "USER_URI" CHARACTER(255) DEFAULT '' NOT NULL
+    "USER_URI" VARCHAR(255) DEFAULT '' NOT NULL
 );
 -- 0 +/- SELECT COUNT(*) FROM PUBLIC.FAVORITES;
 CREATE MEMORY TABLE "PUBLIC"."AUTH"(
@@ -152,8 +151,8 @@ CREATE MEMORY TABLE "PUBLIC"."REPLIES"(
     "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,
+    "USER_URI" VARCHAR(255) DEFAULT NULL,
+    "REPLY_URI" VARCHAR(255) DEFAULT NULL,
     "HTML" TINYINT DEFAULT '0' NOT NULL
 );
 -- 0 +/- SELECT COUNT(*) FROM PUBLIC.REPLIES;
@@ -194,7 +193,7 @@ CREATE MEMORY TABLE "PUBLIC"."VK"(
     "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
+    "CROSSPOST" SMALLINT DEFAULT '1' NOT NULL
 );
 -- 0 +/- SELECT COUNT(*) FROM PUBLIC.VK;
 CREATE MEMORY TABLE "PUBLIC"."SUBSCR_MESSAGES"(
@@ -210,8 +209,8 @@ CREATE MEMORY TABLE "PUBLIC"."SUBSCR_TAGS"(
 -- 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,
+    "NICK" VARCHAR(64) NOT NULL,
+    "PASSW" VARCHAR(32) NOT NULL,
     "LANG" ENUM('en', 'ru', 'fr', 'fa', '__') DEFAULT '__' NOT NULL,
     "BANNED" TINYINT DEFAULT '0' NOT NULL,
     "LASTMESSAGE" TIMESTAMP(6) NOT NULL,
@@ -225,8 +224,8 @@ 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,
+    "TOP" BOOLEAN DEFAULT FALSE NOT NULL,
+    "NOINDEX" BOOLEAN DEFAULT FALSE NOT NULL,
     "STAT_MESSAGES" INTEGER DEFAULT '0' NOT NULL,
     "STAT_USERS" SMALLINT DEFAULT '0' NOT NULL
 );
@@ -303,14 +302,14 @@ ALTER TABLE "PUBLIC"."USERSINFO" ADD CONSTRAINT "PUBLIC"."CONSTRAINT_BB6" PRIMAR
 -- 0 +/- SELECT COUNT(*) FROM PUBLIC.USERSINFO;
 CREATE MEMORY TABLE "PUBLIC"."EMAILS"(
     "USER_ID" INTEGER NOT NULL,
-    "EMAIL" CHARACTER(64) NOT NULL,
+    "EMAIL" VARCHAR(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,
+    "TOKEN" VARCHAR(64) NOT NULL,
     "TS" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
 );
 -- 0 +/- SELECT COUNT(*) FROM PUBLIC.IOS;
-- 
cgit v1.2.3

