diff options
Diffstat (limited to 'db/migrate/20200121194154_add_geo_events_foreign_key.rb')
-rw-r--r-- | db/migrate/20200121194154_add_geo_events_foreign_key.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20200121194154_add_geo_events_foreign_key.rb b/db/migrate/20200121194154_add_geo_events_foreign_key.rb new file mode 100644 index 00000000000..b5e16e22989 --- /dev/null +++ b/db/migrate/20200121194154_add_geo_events_foreign_key.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddGeoEventsForeignKey < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :geo_event_log, :geo_events, + column: :geo_event_id, + name: 'fk_geo_event_log_on_geo_event_id', + on_delete: :cascade + end + + def down + remove_foreign_key_without_error :geo_event_log, column: :geo_event_id, name: 'fk_geo_event_log_on_geo_event_id' + end +end |