cartodb/db/migrate/20150727105500_add_admin_email_to_organizations.rb

24 lines
478 B
Ruby
Raw Permalink Normal View History

2020-06-15 10:58:47 +08:00
Sequel.migration do
up do
begin
alter_table :organizations do
add_column :admin_email, :text
end
rescue
# Weird scenario that column already exists. probably due to a file timestamp change
end
SequelRails.connection.run(%Q{
update organizations o set admin_email = (select email from users u where o.owner_id = u.id);
})
end
down do
alter_table :organizations do
drop_column :admin_email
end
end
end