2 NO CONSIGO CREAR UN SCRIPT DDL QUE VALGA PARA H2 E INNODB
4 CON LIQUIBASE SÍ PUEDO PORQUE LIQUIBASE (con XML) SE ENCARGA ÉL
5 DE ADAPTARLO PARA QUE ENTRE EN H2
7 SUPONGO QUE FLYWAY PODRÍA USARSE SIN PROBLEMAS CUANDO TENGA LA
8 BASE DE DATOS DOCKERIZADA (EN LUGAR DE USAR H2 PARA LOS TESTS USAR DOCKER)
10 SI USO H2 PARA LOS TESTS LIQUIBASE PARECE MEJOR (usando el formato XML
11 de definición de changesets) PORQUE ADAPTA LOS STATEMENTS DE CREACIÓN A H2
17 ID BIGINT AUTO_INCREMENT NOT NULL,
19 COMPANY_CATEG_ID BIGINT,
21 AD_MOBILE_IMAGE VARCHAR(255),
22 CREATED_AT TIMESTAMP DEFAULT NOW() NOT NULL,
23 UPDATED_AT TIMESTAMP DEFAULT '1970-01-01 00:00:01' NOT NULL,
24 CONSTRAINT PK_AD PRIMARY KEY (ID)
28 CREATE TABLE AD_AUDITED (
30 REVISION BIGINT NOT NULL,
31 REVISION_TYPE TINYINT(3),
33 REVISION_END_TIMESTAMP TIMESTAMP,
34 AD_MOBILE_IMAGE VARCHAR(255),
35 adMobileImage_MODIFIED BOOLEAN(1),
36 COMPANY_CATEG_ID BIGINT,
37 companyCategId_MODIFIED BOOLEAN(1),
39 companyId_MODIFIED BOOLEAN(1),
41 createdAt_MODIFIED BOOLEAN(1),
43 updatedAt_MODIFIED BOOLEAN(1),
44 adDescriptions_MODIFIED BOOLEAN(1));
47 CREATE TABLE AD_DESCRIPTION (
48 ID BIGINT AUTO_INCREMENT NOT NULL,
49 LANGUAGE_ID BIGINT NOT NULL,
51 AD_NAME VARCHAR(255) NOT NULL,
53 AD_MOBILE_TEXT VARCHAR(500) NOT NULL,
54 AD_LINK VARCHAR(3000) NOT NULL,
55 CONSTRAINT PK_AD_DESCRIPTION PRIMARY KEY (ID)
60 CREATE TABLE AD_DESCRIPTION_AUDITED (
62 REVISION BIGINT NOT NULL,
63 REVISION_TYPE TINYINT(3),
65 REVISION_END_TIMESTAMP TIMESTAMP,
66 AD_DESCRIPTION VARCHAR(255),
68 AD_MOBILE_TEXT VARCHAR(255),
76 CREATE TABLE CUSTOM_REVISION (
77 ID BIGINT AUTO_INCREMENT NOT NULL,
78 REVISION_DATE TIMESTAMP NOT NULL,
79 USERNAME VARCHAR(255),
80 CONSTRAINT PK_CUSTOM_REVISION PRIMARY KEY (ID)
93 ID bigint(20) NOT NULL AUTO_INCREMENT,
94 COMPANY_ID bigint(20) DEFAULT NULL,
95 COMPANY_CATEG_ID bigint(20) DEFAULT NULL,
97 AD_MOBILE_IMAGE varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
98 CREATED_AT timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
99 UPDATED_AT timestamp NOT NULL DEFAULT '1970-01-01 00:00:01',
104 CREATE TABLE AD_DESCRIPTION (
105 ID bigint(20) NOT NULL AUTO_INCREMENT,
106 LANGUAGE_ID bigint(20) NOT NULL,
107 AD_ID bigint(20) DEFAULT NULL,
108 AD_NAME varchar(255) COLLATE utf8_unicode_ci NOT NULL,
109 AD_DESCRIPTION longtext COLLATE utf8_unicode_ci,
110 AD_MOBILE_TEXT varchar(500) COLLATE utf8_unicode_ci NOT NULL,
111 AD_LINK varchar(3000) COLLATE utf8_unicode_ci NOT NULL,
113 KEY IND_01_AD_DESCRIPTION (AD_ID),
114 CONSTRAINT FK_01_AD_DESCRIPTION FOREIGN KEY (AD_ID) REFERENCES AD (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
118 CREATE TABLE CUSTOM_REVISION (
119 ID bigint(20) NOT NULL AUTO_INCREMENT,
120 REVISION_DATE timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
121 USERNAME varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
126 CREATE TABLE AD_AUDITED (
127 ID bigint(20) NOT NULL,
128 REVISION bigint(20) NOT NULL,
129 REVISION_TYPE tinyint(3) DEFAULT NULL,
130 REVISION_END bigint(20) DEFAULT NULL,
131 REVISION_END_TIMESTAMP datetime DEFAULT NULL,
132 AD_MOBILE_IMAGE varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
133 adMobileImage_MODIFIED bit(1) DEFAULT NULL,
134 COMPANY_CATEG_ID bigint(20) DEFAULT NULL,
135 companyCategId_MODIFIED bit(1) DEFAULT NULL,
136 COMPANY_ID bigint(20) DEFAULT NULL,
137 companyId_MODIFIED bit(1) DEFAULT NULL,
138 CREATED_AT datetime DEFAULT NULL,
139 createdAt_MODIFIED bit(1) DEFAULT NULL,
140 UPDATED_AT datetime DEFAULT NULL,
141 updatedAt_MODIFIED bit(1) DEFAULT NULL,
142 adDescriptions_MODIFIED bit(1) DEFAULT NULL,
143 PRIMARY KEY (ID,REVISION),
144 KEY IND_01_AD_AUDITED (REVISION),
145 KEY IND_02_AD_AUDITED (REVISION_END),
146 CONSTRAINT FK_01_AD_AUDITED FOREIGN KEY (REVISION) REFERENCES CUSTOM_REVISION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
147 CONSTRAINT FK_02_AD_AUDITED FOREIGN KEY (REVISION_END) REFERENCES CUSTOM_REVISION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
151 -- CREATE TABLE "MYBATIS_EXAMPLE"."AD_AUDITED" ("ID" BIGINT NOT NULL, "REVISION" BIGINT NOT NULL, "REVISION_TYPE" TINYINT(3), "REVISION_END" BIGINT, "REVISION_END_TIMESTAMP" TIMESTAMP, "AD_MOBILE_IMAGE" VARCHAR(255), "adMobileImage_MODIFIED" BOOLEAN(1), "COMPANY_CATEG_ID" BIGINT, "companyCategId_MODIFIED" BOOLEAN(1), "COMPANY_ID" BIGINT, "companyId_MODIFIED" BOOLEAN(1), "CREATED_AT" TIMESTAMP, "createdAt_MODIFIED" BOOLEAN(1), "UPDATED_AT" TIMESTAMP, "updatedAt_MODIFIED" BOOLEAN(1), "adDescriptions_MODIFIED" BOOLEAN(1))
156 CREATE TABLE AD_DESCRIPTION_AUDITED (
157 ID bigint(20) NOT NULL,
158 REVISION bigint(20) NOT NULL,
159 REVISION_TYPE tinyint(3) DEFAULT NULL,
160 REVISION_END bigint(20) DEFAULT NULL,
161 REVISION_END_TIMESTAMP datetime DEFAULT NULL,
162 AD_DESCRIPTION varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
163 AD_LINK varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
164 AD_MOBILE_TEXT varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
165 AD_NAME varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
166 LANGUAGE_ID bigint(20) DEFAULT NULL,
167 AD_ID bigint(20) DEFAULT NULL,
168 PRIMARY KEY (ID,REVISION),
169 KEY IND_01_AD_DESCRIPTION_AUDITED (REVISION),
170 KEY IND_02_AD_DESCRIPTION_AUDITED (REVISION_END),
171 CONSTRAINT FK_01_AD_DESCRIPTION_AUDITED FOREIGN KEY (REVISION) REFERENCES CUSTOM_REVISION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
172 CONSTRAINT FK_02_AD_DESCRIPTION_AUDITED FOREIGN KEY (REVISION_END) REFERENCES CUSTOM_REVISION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION