diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-03 12:15:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-03 12:15:44 +0300 |
commit | 7d297faa51b362b48c39fe966ff4afac1029ba7c (patch) | |
tree | 424e612f5e5d883dafd6a3c476ccc267f00fb115 /db/migrate | |
parent | 27a12ac52d8f27af0ec84c516dc1eebbbc74a6b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20231220113459_add_work_item_color.rb | 20 | ||||
-rw-r--r-- | db/migrate/20231226052618_add_work_item_colors_foreign_keys.rb | 18 |
2 files changed, 38 insertions, 0 deletions
diff --git a/db/migrate/20231220113459_add_work_item_color.rb b/db/migrate/20231220113459_add_work_item_color.rb new file mode 100644 index 00000000000..127f93f41ea --- /dev/null +++ b/db/migrate/20231220113459_add_work_item_color.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddWorkItemColor < Gitlab::Database::Migration[2.2] + enable_lock_retries! + milestone '16.8' + + def up + create_table :work_item_colors, id: false do |t| + t.timestamps_with_timezone null: false + t.references :issue, primary_key: true, index: false, default: nil, + foreign_key: { on_delete: :cascade, to_table: :issues } + t.bigint :namespace_id, null: false + t.text :color, null: false, limit: 7 + end + end + + def down + drop_table :work_item_colors + end +end diff --git a/db/migrate/20231226052618_add_work_item_colors_foreign_keys.rb b/db/migrate/20231226052618_add_work_item_colors_foreign_keys.rb new file mode 100644 index 00000000000..4fa0806a28a --- /dev/null +++ b/db/migrate/20231226052618_add_work_item_colors_foreign_keys.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddWorkItemColorsForeignKeys < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.8' + + TABLE = :work_item_colors + + def up + add_concurrent_index TABLE, :namespace_id, name: "wi_colors_namespace_id_index" + add_concurrent_foreign_key TABLE, :namespaces, column: :namespace_id, on_delete: :nullify + end + + def down + remove_concurrent_index_by_name TABLE, name: "wi_colors_namespace_id_index" + remove_foreign_key_if_exists TABLE, :namespaces, column: :namespace_id + end +end |