wedding-planner/db/migrate/20241111063741_merge_guest_names.rb
Manuel Bustillo 5f9b64a93b
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 2m22s
Add copyright notice / copyright_notice (pull_request) Successful in 3m28s
Run unit tests / unit_tests (pull_request) Successful in 6m23s
Merge first and last name and expose guest update endpoint
2024-11-11 07:43:42 +01:00

18 lines
385 B
Ruby

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