cartodb-4.42/db/migrate/20110118160935_user_tables.rb

30 lines
724 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
class UserTablesMigration < Sequel::Migration
def up
create_table :user_tables do
primary_key :id
Integer :user_id, :null => false, :index => true
String :name, :null => false
Integer :privacy, :null => false
DateTime :updated_at, :null => false
String :tags, :text => true
String :geometry_columns
Integer :rows_counted
Integer :rows_estimated
end
alter_table(:user_tables) do
add_index [:user_id, :privacy]
add_index [:name, :user_id], :unique => true
set_column_default :privacy, 0
set_column_default :rows_counted, 0
set_column_default :rows_estimated, 0
end
end
def down
drop_table :user_tables
end
end