2025-01-13 21:37:02 +01:00
|
|
|
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
2024-11-11 06:57:39 +00:00
|
|
|
|
2024-11-11 07:43:42 +01:00
|
|
|
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
|