summaryrefslogtreecommitdiff
path: root/db/migrate/20210305180331_create_ci_unit_tests.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20210305180331_create_ci_unit_tests.rb')
-rw-r--r--db/migrate/20210305180331_create_ci_unit_tests.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/db/migrate/20210305180331_create_ci_unit_tests.rb b/db/migrate/20210305180331_create_ci_unit_tests.rb
new file mode 100644
index 00000000000..970834a025b
--- /dev/null
+++ b/db/migrate/20210305180331_create_ci_unit_tests.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class CreateCiUnitTests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:ci_unit_tests)
+ create_table :ci_unit_tests do |t|
+ t.bigint :project_id, null: false
+ t.text :key_hash, null: false
+ t.text :name, null: false
+ t.text :suite_name, null: false
+
+ t.index [:project_id, :key_hash], unique: true
+ # NOTE: FK for projects will be added on a separate migration as per guidelines
+ end
+ end
+
+ add_text_limit :ci_unit_tests, :key_hash, 64
+ add_text_limit :ci_unit_tests, :name, 255
+ add_text_limit :ci_unit_tests, :suite_name, 255
+ end
+
+ def down
+ drop_table :ci_unit_tests
+ end
+end