From 97f2c01fdd4ae863134d4aa1bf32b7dcd512b10c Mon Sep 17 00:00:00 2001 From: Jacek Date: Thu, 17 Jun 2021 12:33:39 +0200 Subject: [PATCH] SONAR-14792 Fix issue on Oracle DB by recreating PK for 'snapshots' table --- server/sonar-db-dao/src/schema/schema-sq.ddl | 1 - .../version/v00/CreateInitialSchema.java | 1 - ...rimaryKeyOnUuidColumnOfSnapshotsTable.java | 39 ++++++++++++++ .../db/migration/version/v90/DbVersion90.java | 5 +- .../version/v90/DropAnalysesUuidIndex.java | 32 +++++++++++ ...rimaryKeyOnUuidColumnOfSnapshotsTable.java | 40 ++++++++++++++ ...ryKeyOnUuidColumnOfSnapshotsTableTest.java | 40 ++++++++++++++ .../version/v90/DbVersion90Test.java | 2 +- .../v90/DropAnalysesUuidIndexTest.java | 49 +++++++++++++++++ ...ryKeyOnUuidColumnOfSnapshotsTableTest.java | 53 +++++++++++++++++++ .../schema.sql | 16 ++++++ .../v90/DropAnalysesUuidIndexTest/schema.sql | 18 +++++++ .../schema.sql | 17 ++++++ 13 files changed, 309 insertions(+), 4 deletions(-) create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTable.java create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndex.java create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTable.java create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndexTest.java create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java create mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql create mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndexTest/schema.sql create mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql diff --git a/server/sonar-db-dao/src/schema/schema-sq.ddl b/server/sonar-db-dao/src/schema/schema-sq.ddl index a108c6ec266..5eba94209d7 100644 --- a/server/sonar-db-dao/src/schema/schema-sq.ddl +++ b/server/sonar-db-dao/src/schema/schema-sq.ddl @@ -846,7 +846,6 @@ CREATE TABLE "SNAPSHOTS"( "CREATED_AT" BIGINT ); ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS"("UUID"); CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); CREATE TABLE "USER_DISMISSED_MESSAGES"( diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchema.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchema.java index e9e4ecdf4ec..d2d9ff62034 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchema.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchema.java @@ -1308,7 +1308,6 @@ public class CreateInitialSchema extends DdlChange { .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period1_date").setIsNullable(true).build()) .addColumn(NULLABLE_TECHNICAL_CREATED_AT_COL) .build()); - addIndex(context, tableName, "analyses_uuid", true, uuidCol); addIndex(context, tableName, "snapshot_component", false, componentUuidCol); } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTable.java new file mode 100644 index 00000000000..15af703c5f3 --- /dev/null +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTable.java @@ -0,0 +1,39 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.db.migration.version.v90; + +import java.sql.SQLException; +import org.sonar.db.Database; +import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; +import org.sonar.server.platform.db.migration.step.DdlChange; + +public class AddPrimaryKeyOnUuidColumnOfSnapshotsTable extends DdlChange { + private static final String TABLE_NAME = "snapshots"; + + public AddPrimaryKeyOnUuidColumnOfSnapshotsTable(Database db) { + super(db); + } + + @Override + public void execute(Context context) throws SQLException { + context.execute(new AddPrimaryKeyBuilder(TABLE_NAME, "uuid").build()); + } + +} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90.java index e66843adb73..f53e7a98a0f 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90.java @@ -34,6 +34,9 @@ public class DbVersion90 implements DbVersion { .add(5006, "Recreate PK on 'uuid' for 'events' table", AddPrimaryKeyOnUuidColumnOfEventsTable.class) .add(5007, "Drop PK on 'kee' for 'issues' table", DropPrimaryKeyOnKeeColumnOfIssuesTable.class) .add(5008, "Drop 'issues_kee' index", DropIssuesKeeIndex.class) - .add(5009, "Recreate PK on 'kee' for 'issues' table", AddPrimaryKeyOnKeeColumnOfIssuesTable.class); + .add(5009, "Recreate PK on 'kee' for 'issues' table", AddPrimaryKeyOnKeeColumnOfIssuesTable.class) + .add(5010, "Drop PK on 'kee' for 'snapshots' table", DropPrimaryKeyOnUuidColumnOfSnapshotsTable.class) + .add(5011, "Drop 'analyses_uuid' index", DropAnalysesUuidIndex.class) + .add(5012, "Recreate PK on 'kee' for 'snapshots' table", AddPrimaryKeyOnUuidColumnOfSnapshotsTable.class); } } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndex.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndex.java new file mode 100644 index 00000000000..14e82d1c3c2 --- /dev/null +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndex.java @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.db.migration.version.v90; + +import org.sonar.db.Database; +import org.sonar.server.platform.db.migration.step.DropIndexChange; + +public class DropAnalysesUuidIndex extends DropIndexChange { + private static final String INDEX_NAME = "analyses_uuid"; + private static final String TABLE_NAME = "snapshots"; + + public DropAnalysesUuidIndex(Database db) { + super(db, INDEX_NAME, TABLE_NAME); + } +} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTable.java new file mode 100644 index 00000000000..c03259cd57c --- /dev/null +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTable.java @@ -0,0 +1,40 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.db.migration.version.v90; + +import java.sql.SQLException; +import org.sonar.db.Database; +import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; +import org.sonar.server.platform.db.migration.step.DdlChange; + +public class DropPrimaryKeyOnUuidColumnOfSnapshotsTable extends DdlChange { + private static final String TABLE_NAME = "snapshots"; + private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; + + public DropPrimaryKeyOnUuidColumnOfSnapshotsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { + super(db); + this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; + } + + @Override + public void execute(Context context) throws SQLException { + context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, "uuid", false)); + } +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java new file mode 100644 index 00000000000..fa92c35b364 --- /dev/null +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java @@ -0,0 +1,40 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.db.migration.version.v90; + +import java.sql.SQLException; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.db.CoreDbTester; + +public class AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest { + + @Rule + public final CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.class, "schema.sql"); + + private final AddPrimaryKeyOnUuidColumnOfSnapshotsTable underTest = new AddPrimaryKeyOnUuidColumnOfSnapshotsTable(db.database()); + + @Test + public void migration_should_drop_PK_on_snapshots() throws SQLException { + db.assertNoPrimaryKey("snapshots"); + underTest.execute(); + db.assertPrimaryKey("snapshots", "pk_snapshots", "uuid"); + } +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90Test.java index e261935bbdb..42feabb1060 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90Test.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DbVersion90Test.java @@ -41,7 +41,7 @@ public class DbVersion90Test { @Test public void verify_migration_count() { - verifyMigrationCount(underTest, 9); + verifyMigrationCount(underTest, 12); } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndexTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndexTest.java new file mode 100644 index 00000000000..cffb5e2afe9 --- /dev/null +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndexTest.java @@ -0,0 +1,49 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.db.migration.version.v90; + +import java.sql.SQLException; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.db.CoreDbTester; + +public class DropAnalysesUuidIndexTest { + + @Rule + public final CoreDbTester db = CoreDbTester.createForSchema(DropAnalysesUuidIndexTest.class, "schema.sql"); + + private final DropAnalysesUuidIndex underTest = new DropAnalysesUuidIndex(db.database()); + + @Test + public void migration_should_drop_unique_index_on_snapshots() throws SQLException { + db.assertUniqueIndex("snapshots", "analyses_uuid", "uuid"); + underTest.execute(); + db.assertIndexDoesNotExist("snapshots", "analyses_uuid"); + } + + @Test + public void migration_should_be_reentrant() throws SQLException { + db.assertUniqueIndex("snapshots", "analyses_uuid", "uuid"); + underTest.execute(); + // re-entrant + underTest.execute(); + db.assertIndexDoesNotExist("snapshots", "analyses_uuid"); + } +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java new file mode 100644 index 00000000000..d7168253512 --- /dev/null +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java @@ -0,0 +1,53 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.platform.db.migration.version.v90; + +import java.sql.SQLException; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; +import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; + +public class DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest { + + @Rule + public final CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest.class, "schema.sql"); + + private final DropPrimaryKeyOnUuidColumnOfSnapshotsTable underTest = new DropPrimaryKeyOnUuidColumnOfSnapshotsTable( + db.database(), + new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database()))); + + @Test + public void migration_should_drop_PK_on_snapshots() throws SQLException { + db.assertPrimaryKey("snapshots", "pk_snapshots", "uuid"); + underTest.execute(); + db.assertNoPrimaryKey("snapshots"); + } + + @Test + public void migration_should_be_reentrant() throws SQLException { + db.assertPrimaryKey("snapshots", "pk_snapshots", "uuid"); + underTest.execute(); + // re-entrant + underTest.execute(); + db.assertNoPrimaryKey("snapshots"); + } +} diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql new file mode 100644 index 00000000000..998a206fa94 --- /dev/null +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql @@ -0,0 +1,16 @@ +CREATE TABLE "SNAPSHOTS"( + "UUID" VARCHAR(50) NOT NULL, + "COMPONENT_UUID" VARCHAR(50) NOT NULL, + "STATUS" VARCHAR(4) DEFAULT 'U' NOT NULL, + "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, + "VERSION" VARCHAR(500), + "PURGE_STATUS" INTEGER, + "BUILD_STRING" VARCHAR(100), + "REVISION" VARCHAR(100), + "BUILD_DATE" BIGINT, + "PERIOD1_MODE" VARCHAR(100), + "PERIOD1_PARAM" VARCHAR(100), + "PERIOD1_DATE" BIGINT, + "CREATED_AT" BIGINT +); +CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndexTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndexTest/schema.sql new file mode 100644 index 00000000000..9f152a054ab --- /dev/null +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropAnalysesUuidIndexTest/schema.sql @@ -0,0 +1,18 @@ +CREATE TABLE "SNAPSHOTS"( + "UUID" VARCHAR(50) NOT NULL, + "COMPONENT_UUID" VARCHAR(50) NOT NULL, + "STATUS" VARCHAR(4) DEFAULT 'U' NOT NULL, + "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, + "VERSION" VARCHAR(500), + "PURGE_STATUS" INTEGER, + "BUILD_STRING" VARCHAR(100), + "REVISION" VARCHAR(100), + "BUILD_DATE" BIGINT, + "PERIOD1_MODE" VARCHAR(100), + "PERIOD1_PARAM" VARCHAR(100), + "PERIOD1_DATE" BIGINT, + "CREATED_AT" BIGINT +); +ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); +CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS"("UUID"); +CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql new file mode 100644 index 00000000000..7123c00ddc0 --- /dev/null +++ b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v90/DropPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql @@ -0,0 +1,17 @@ +CREATE TABLE "SNAPSHOTS"( + "UUID" VARCHAR(50) NOT NULL, + "COMPONENT_UUID" VARCHAR(50) NOT NULL, + "STATUS" VARCHAR(4) DEFAULT 'U' NOT NULL, + "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, + "VERSION" VARCHAR(500), + "PURGE_STATUS" INTEGER, + "BUILD_STRING" VARCHAR(100), + "REVISION" VARCHAR(100), + "BUILD_DATE" BIGINT, + "PERIOD1_MODE" VARCHAR(100), + "PERIOD1_PARAM" VARCHAR(100), + "PERIOD1_DATE" BIGINT, + "CREATED_AT" BIGINT +); +ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); +CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); -- 2.39.5