3 * Copyright (C) 2009-2021 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.server.platform.db.migration.version.v85;
22 import java.sql.SQLException;
23 import org.junit.Rule;
24 import org.junit.Test;
25 import org.junit.rules.ExpectedException;
26 import org.sonar.db.CoreDbTester;
28 import static java.sql.Types.BIGINT;
29 import static java.sql.Types.CLOB;
30 import static java.sql.Types.VARCHAR;
32 public class CreateTmpIssueChangesTableTest {
34 private static final String TABLE_NAME = "tmp_issue_changes";
37 public CoreDbTester dbTester = CoreDbTester.createForSchema(CreateTmpIssueChangesTableTest.class, "schema.sql");
40 public ExpectedException expectedException = ExpectedException.none();
42 private CreateTmpIssueChangesTable underTest = new CreateTmpIssueChangesTable(dbTester.database());
45 public void table_has_been_created() throws SQLException {
48 dbTester.assertTableExists(TABLE_NAME);
49 dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, true);
50 dbTester.assertColumnDefinition(TABLE_NAME, "kee", VARCHAR, 50, true);
51 dbTester.assertColumnDefinition(TABLE_NAME, "issue_key", VARCHAR, 50, true);
52 dbTester.assertColumnDefinition(TABLE_NAME, "user_login", VARCHAR, 255, true);
53 dbTester.assertColumnDefinition(TABLE_NAME, "change_type", VARCHAR, 20, true);
54 dbTester.assertColumnDefinition(TABLE_NAME, "change_data", CLOB, null, true);
55 dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, null, true);
56 dbTester.assertColumnDefinition(TABLE_NAME, "updated_at", BIGINT, null, true);
57 dbTester.assertColumnDefinition(TABLE_NAME, "issue_change_creation_date", BIGINT, null, true);
58 dbTester.assertColumnDefinition(TABLE_NAME, "project_uuid", VARCHAR, 50, true);