Sha256: fe6899dc34d2a7dfcdba9c9adb708a5691feaa8c907721cc7ddf8012f390270e
Contents?: true
Size: 616 Bytes
Versions: 30
Compression:
Stored size: 616 Bytes
Contents
class MigratePersonResidenceToAddresses < ActiveRecord::Migration[6.1] def up add_column :egov_utils_addresses, :person_id, :bigint, index: true add_foreign_key :egov_utils_addresses, :egov_utils_people, column: :person_id execute <<-SQL UPDATE egov_utils_addresses SET person_id = egov_utils_people.id FROM egov_utils_people WHERE egov_utils_addresses.id = egov_utils_people.residence_id; SQL remove_index :egov_utils_people, :residence_id remove_column :egov_utils_people, :residence_id end def down raise ActiveRecord::IrreversibleMigration end end
Version data entries
30 entries across 30 versions & 1 rubygems