diff options
Diffstat (limited to 'db/migrate/20240104124057_add_category_to_timelogs.rb')
-rw-r--r-- | db/migrate/20240104124057_add_category_to_timelogs.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/db/migrate/20240104124057_add_category_to_timelogs.rb b/db/migrate/20240104124057_add_category_to_timelogs.rb new file mode 100644 index 00000000000..adda5fef873 --- /dev/null +++ b/db/migrate/20240104124057_add_category_to_timelogs.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AddCategoryToTimelogs < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.8' + + def up + add_column :timelogs, :timelog_category_id, :bigint + add_concurrent_index(:timelogs, :timelog_category_id) + add_concurrent_foreign_key( + :timelogs, + :timelog_categories, + column: :timelog_category_id, + on_delete: :nullify + ) + end + + def down + remove_column :timelogs, :timelog_category_id + end +end |