Browse Source

Add extract_foreign_key_action to Mastodon::MigrationHelpers (#7195)

pull/4/head
Yamagishi Kazutoshi 6 years ago
committed by Eugen Rochko
parent
commit
084cf0babf
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      lib/mastodon/migration_helpers.rb

+ 11
- 0
lib/mastodon/migration_helpers.rb View File

@ -985,6 +985,17 @@ into similar problems in the future (e.g. when new tables are created).
BackgroundMigrationWorker.perform_in(delay_interval * index, job_class_name, [start_id, end_id])
end
end
private
# https://github.com/rails/rails/blob/v5.2.0/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#L678-L684
def extract_foreign_key_action(specifier)
case specifier
when 'c'; :cascade
when 'n'; :nullify
when 'r'; :restrict
end
end
end
end

Loading…
Cancel
Save