cartodb-4.42/db/migrate/20160329121128_add_permission_id_fk_to_visualization.rb

19 lines
538 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
Sequel.migration do
up do
SequelRails.connection.transaction do
Rake::Task['cartodb:permissions:fill_missing_permissions'].invoke(true) unless Carto::Visualization.count == 0
alter_table :visualizations do
set_column_allow_null :permission_id, false
add_foreign_key [:permission_id], :permissions, null: false
end
end
end
down do
alter_table :visualizations do
drop_constraint :visualizations_permission_id_fkey
set_column_allow_null :permission_id, true
end
end
end