cartodb/db/migrate/20180308130229_add_missing_indices.rb

22 lines
702 B
Ruby
Raw Normal View History

2020-06-15 10:58:47 +08:00
# This migration does not include Carto::Db::MigrationHelper on purpose
# It creates index concurrently, and that needs to be done outside of a transaction
require 'carto/db/migration_helper'
include Carto::Db::MigrationHelper
migration(
Proc.new do
add_index :geocodings, [:user_id, :created_at]
add_index :layers_user_tables, [:layer_id]
add_index :layers_user_tables, [:user_table_id, :layer_id]
add_index :user_tables, [:user_id, :name]
end,
Proc.new do
drop_index :geocodings, [:user_id, :created_at]
drop_index :layers_user_tables, [:layer_id]
drop_index :layers_user_tables, [:user_table_id, :layer_id]
drop_index :user_tables, [:user_id, :name]
end
)