cartodb/db/migrate/20170309095734_create_notifications.rb

24 lines
630 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
create_table :notifications do
Uuid :id, primary_key: true, default: Sequel.lit('uuid_generate_v4()')
foreign_key :organization_id, :organizations, type: :uuid, on_delete: :cascade
String :icon, null: false
String :recipients
String :body, null: false
DateTime :created_at, null: false, default: Sequel::CURRENT_TIMESTAMP
end
alter_table :notifications do
add_index [:organization_id]
end
end,
Proc.new do
drop_table :notifications
end
)