summaryrefslogtreecommitdiff
path: root/db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb')
-rw-r--r--db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb27
1 files changed, 0 insertions, 27 deletions
diff --git a/db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb b/db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb
deleted file mode 100644
index 631cc27c8c0..00000000000
--- a/db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class AddFunctionForInsertingDeletedRecords < ActiveRecord::Migration[6.1]
- include Gitlab::Database::MigrationHelpers
- include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers
-
- def up
- execute(<<~SQL)
- CREATE OR REPLACE FUNCTION #{DELETED_RECORDS_INSERT_FUNCTION_NAME}()
- RETURNS TRIGGER AS
- $$
- BEGIN
- INSERT INTO loose_foreign_keys_deleted_records
- (deleted_table_name, deleted_table_primary_key_value)
- SELECT TG_TABLE_NAME, old_table.id FROM old_table
- ON CONFLICT DO NOTHING;
-
- RETURN NULL;
- END
- $$ LANGUAGE PLPGSQL
- SQL
- end
-
- def down
- drop_function(DELETED_RECORDS_INSERT_FUNCTION_NAME)
- end
-end