cartodb-4.29/db/migrate/20140625140749_add_recipients_to_shared_entities.rb
2020-06-15 10:58:47 +08:00

15 lines
510 B
Ruby

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