--- /dev/null
+<!--
+ NO CONSIGO CREAR UN SCRIPT DDL QUE VALGA PARA H2 E INNODB
+
+ CON LIQUIBASE SÍ PUEDO PORQUE LIQUIBASE (con XML) SE ENCARGA ÉL
+ DE ADAPTARLO PARA QUE ENTRE EN H2
+
+ SUPONGO QUE FLYWAY PODRÍA USARSE SIN PROBLEMAS CUANDO TENGA LA
+ BASE DE DATOS DOCKERIZADA (EN LUGAR DE USAR H2 PARA LOS TESTS USAR DOCKER)
+
+ SI USO H2 PARA LOS TESTS LIQUIBASE PARECE MEJOR (usando el formato XML
+ de definición de changesets) PORQUE ADAPTA LOS STATEMENTS DE CREACIÓN A H2
+ Y MYSQL :(
+
+-->
+
+CREATE TABLE AD (
+ ID BIGINT AUTO_INCREMENT NOT NULL,
+ COMPANY_ID BIGINT,
+ COMPANY_CATEG_ID BIGINT,
+ AD_GPS BLOB,
+ AD_MOBILE_IMAGE VARCHAR(255),
+ CREATED_AT TIMESTAMP DEFAULT NOW() NOT NULL,
+ UPDATED_AT TIMESTAMP DEFAULT '1970-01-01 00:00:01' NOT NULL,
+ CONSTRAINT PK_AD PRIMARY KEY (ID)
+ );
+
+
+CREATE TABLE 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));
+
+
+CREATE TABLE AD_DESCRIPTION (
+ ID BIGINT AUTO_INCREMENT NOT NULL,
+ LANGUAGE_ID BIGINT NOT NULL,
+ AD_ID BIGINT,
+ AD_NAME VARCHAR(255) NOT NULL,
+ AD_DESCRIPTION CLOB,
+ AD_MOBILE_TEXT VARCHAR(500) NOT NULL,
+ AD_LINK VARCHAR(3000) NOT NULL,
+ CONSTRAINT PK_AD_DESCRIPTION PRIMARY KEY (ID)
+ );
+
+
+
+CREATE TABLE AD_DESCRIPTION_AUDITED (
+ ID BIGINT NOT NULL,
+ REVISION BIGINT NOT NULL,
+ REVISION_TYPE TINYINT(3),
+ REVISION_END BIGINT,
+ REVISION_END_TIMESTAMP TIMESTAMP,
+ AD_DESCRIPTION VARCHAR(255),
+ AD_LINK VARCHAR(255),
+ AD_MOBILE_TEXT VARCHAR(255),
+ AD_NAME VARCHAR(255),
+ LANGUAGE_ID BIGINT,
+ AD_ID BIGINT
+ );
+
+
+
+CREATE TABLE CUSTOM_REVISION (
+ ID BIGINT AUTO_INCREMENT NOT NULL,
+ REVISION_DATE TIMESTAMP NOT NULL,
+ USERNAME VARCHAR(255),
+ CONSTRAINT PK_CUSTOM_REVISION PRIMARY KEY (ID)
+ );
+
+
+
+
+
+
+ -- OTRO
+
+
+
+CREATE TABLE AD (
+ ID bigint(20) NOT NULL AUTO_INCREMENT,
+ COMPANY_ID bigint(20) DEFAULT NULL,
+ COMPANY_CATEG_ID bigint(20) DEFAULT NULL,
+ AD_GPS blob,
+ AD_MOBILE_IMAGE varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ CREATED_AT timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ UPDATED_AT timestamp NOT NULL DEFAULT '1970-01-01 00:00:01',
+ PRIMARY KEY (ID)
+);
+
+
+CREATE TABLE AD_DESCRIPTION (
+ ID bigint(20) NOT NULL AUTO_INCREMENT,
+ LANGUAGE_ID bigint(20) NOT NULL,
+ AD_ID bigint(20) DEFAULT NULL,
+ AD_NAME varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ AD_DESCRIPTION longtext COLLATE utf8_unicode_ci,
+ AD_MOBILE_TEXT varchar(500) COLLATE utf8_unicode_ci NOT NULL,
+ AD_LINK varchar(3000) COLLATE utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (ID),
+ KEY IND_01_AD_DESCRIPTION (AD_ID),
+ CONSTRAINT FK_01_AD_DESCRIPTION FOREIGN KEY (AD_ID) REFERENCES AD (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+
+CREATE TABLE CUSTOM_REVISION (
+ ID bigint(20) NOT NULL AUTO_INCREMENT,
+ REVISION_DATE timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ USERNAME varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ PRIMARY KEY (ID)
+);
+
+
+CREATE TABLE AD_AUDITED (
+ ID bigint(20) NOT NULL,
+ REVISION bigint(20) NOT NULL,
+ REVISION_TYPE tinyint(3) DEFAULT NULL,
+ REVISION_END bigint(20) DEFAULT NULL,
+ REVISION_END_TIMESTAMP datetime DEFAULT NULL,
+ AD_MOBILE_IMAGE varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ adMobileImage_MODIFIED bit(1) DEFAULT NULL,
+ COMPANY_CATEG_ID bigint(20) DEFAULT NULL,
+ companyCategId_MODIFIED bit(1) DEFAULT NULL,
+ COMPANY_ID bigint(20) DEFAULT NULL,
+ companyId_MODIFIED bit(1) DEFAULT NULL,
+ CREATED_AT datetime DEFAULT NULL,
+ createdAt_MODIFIED bit(1) DEFAULT NULL,
+ UPDATED_AT datetime DEFAULT NULL,
+ updatedAt_MODIFIED bit(1) DEFAULT NULL,
+ adDescriptions_MODIFIED bit(1) DEFAULT NULL,
+ PRIMARY KEY (ID,REVISION),
+ KEY IND_01_AD_AUDITED (REVISION),
+ KEY IND_02_AD_AUDITED (REVISION_END),
+ CONSTRAINT FK_01_AD_AUDITED FOREIGN KEY (REVISION) REFERENCES CUSTOM_REVISION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT FK_02_AD_AUDITED FOREIGN KEY (REVISION_END) REFERENCES CUSTOM_REVISION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+--
+-- 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))
+--
+
+
+
+CREATE TABLE AD_DESCRIPTION_AUDITED (
+ ID bigint(20) NOT NULL,
+ REVISION bigint(20) NOT NULL,
+ REVISION_TYPE tinyint(3) DEFAULT NULL,
+ REVISION_END bigint(20) DEFAULT NULL,
+ REVISION_END_TIMESTAMP datetime DEFAULT NULL,
+ AD_DESCRIPTION varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ AD_LINK varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ AD_MOBILE_TEXT varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ AD_NAME varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+ LANGUAGE_ID bigint(20) DEFAULT NULL,
+ AD_ID bigint(20) DEFAULT NULL,
+ PRIMARY KEY (ID,REVISION),
+ KEY IND_01_AD_DESCRIPTION_AUDITED (REVISION),
+ KEY IND_02_AD_DESCRIPTION_AUDITED (REVISION_END),
+ CONSTRAINT FK_01_AD_DESCRIPTION_AUDITED FOREIGN KEY (REVISION) REFERENCES CUSTOM_REVISION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT FK_02_AD_DESCRIPTION_AUDITED FOREIGN KEY (REVISION_END) REFERENCES CUSTOM_REVISION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
+);
+
+
+
+