cartodb-4.42/db/migrate/20140625140749_add_recipients_to_shared_entities.rb

15 lines
510 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
Sequel.migration do
up do
rename_column :shared_entities, :user_id, :recipient_id
rename_column :shared_entities, :type, :entity_type
add_column :shared_entities, :recipient_type, :text
run "ALTER TABLE shared_entities ADD CONSTRAINT recipient_type_check CHECK (recipient_type IN ('user', 'org'));"
end
down do
drop_column :shared_entities, :recipient_type
rename_column :shared_entities, :entity_type, :type
rename_column :shared_entities, :recipient_id, :user_id
end
end