cartodb/db/migrate/20161122173232_drop_bi_datasets_and_bi_visualizations.rb

30 lines
1.0 KiB
Ruby
Raw Normal View History

2020-06-15 10:58:47 +08:00
Sequel.migration do
up do
drop_table :bi_visualizations
drop_table :bi_datasets
end
down do
SequelRails::connection.run 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp"'
create_table :bi_datasets do
Uuid :id, primary_key: true, default: Sequel.lit('uuid_generate_v4()')
String :import_config, null: false, type: 'json'
String :state, null: false
foreign_key :user_id, :users, type: 'uuid', null: false
String :import_source, null: false
String :import_credentials, null: false, type: 'json'
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
end
create_table :bi_visualizations do
Uuid :id, primary_key: true, default: Sequel.lit('uuid_generate_v4()')
String :viz_json, null: false, type: 'json'
foreign_key :bi_dataset_id, :bi_datasets, type: 'uuid', null: false
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
DateTime :updated_at, default: Sequel::CURRENT_TIMESTAMP
end
end
end