cartodb/db/migrate/20190315144818_revamp_visualization_backup.rb

27 lines
937 B
Ruby
Raw Normal View History

2020-06-15 10:58:47 +08:00
require 'carto/db/migration_helper'
include Carto::Db::MigrationHelper
migration(
Proc.new do
drop_table :visualization_backups
create_table :visualization_backups do
Uuid :id, primary_key: true, default: Sequel.lit('uuid_generate_v4()')
foreign_key :user_id, :users, type: :uuid, null: false, on_delete: :cascade
Uuid :visualization_id, null: false
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
String :category, null: false
json :export, null: false
end
end,
Proc.new do
drop_table :visualization_backups
create_table :visualization_backups do
String :username, null: false
Uuid :visualization, null: false, primary_key: true
String :export_vizjson, null: false
DateTime :created_at, default: Sequel::CURRENT_TIMESTAMP
end
end
)