wedding-planner/db/migrate/20241111063741_merge_guest_names.rb
Manuel Bustillo 3b9ca24bcd
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m27s
Add copyright notice / copyright_notice (pull_request) Successful in 3m5s
Run unit tests / unit_tests (pull_request) Successful in 5m2s
Add copyright notice
2024-11-11 06:57:39 +00:00

20 lines
423 B
Ruby

# Copyright (C) 2024 Manuel Bustillo
class MergeGuestNames < ActiveRecord::Migration[8.0]
def change
add_column :guests, :name, :string
reversible do |dir|
dir.up do
execute <<~SQL
UPDATE guests
SET name = CONCAT(first_name, ' ', last_name)
SQL
end
end
remove_column :guests, :first_name, :string
remove_column :guests, :last_name, :string
end
end