Added new migrations for adding indexes

• Added:
- new migrations for adding indexes
This commit is contained in:
mgabdev 2020-07-07 17:25:47 -05:00
parent ddad2121b0
commit 5c36a30b69
5 changed files with 32 additions and 2 deletions

View File

@ -6,7 +6,6 @@
# id :bigint(8) not null, primary key # id :bigint(8) not null, primary key
# uri :string # uri :string
# text :text default(""), not null # text :text default(""), not null
# markdown :text
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null
# in_reply_to_id :bigint(8) # in_reply_to_id :bigint(8)

View File

@ -0,0 +1,10 @@
class AddIndexToAccountFlags < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def change
add_index :accounts, :is_pro, algorithm: :concurrently
add_index :accounts, :is_verified, algorithm: :concurrently
add_index :accounts, :is_donor, algorithm: :concurrently
add_index :accounts, :is_investor, algorithm: :concurrently
end
end

View File

@ -0,0 +1,7 @@
class AddIndexToAccountCreatedAt < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def change
add_index :users, :created_at, algorithm: :concurrently
end
end

View File

@ -0,0 +1,7 @@
class AddIndexToMediaAttachmentType < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def change
add_index :media_attachments, :type, algorithm: :concurrently
end
end

View File

@ -10,9 +10,10 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_05_10_034822) do ActiveRecord::Schema.define(version: 2020_07_07_212951) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql" enable_extension "plpgsql"
create_table "account_conversations", force: :cascade do |t| create_table "account_conversations", force: :cascade do |t|
@ -166,6 +167,10 @@ ActiveRecord::Schema.define(version: 2020_05_10_034822) do
t.boolean "is_investor", default: false, null: false t.boolean "is_investor", default: false, null: false
t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
t.index ["is_donor"], name: "index_accounts_on_is_donor"
t.index ["is_investor"], name: "index_accounts_on_is_investor"
t.index ["is_pro"], name: "index_accounts_on_is_pro"
t.index ["is_verified"], name: "index_accounts_on_is_verified"
t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id" t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
t.index ["uri"], name: "index_accounts_on_uri" t.index ["uri"], name: "index_accounts_on_uri"
t.index ["url"], name: "index_accounts_on_url" t.index ["url"], name: "index_accounts_on_url"
@ -433,6 +438,7 @@ ActiveRecord::Schema.define(version: 2020_05_10_034822) do
t.index ["scheduled_status_id"], name: "index_media_attachments_on_scheduled_status_id" t.index ["scheduled_status_id"], name: "index_media_attachments_on_scheduled_status_id"
t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true
t.index ["status_id"], name: "index_media_attachments_on_status_id" t.index ["status_id"], name: "index_media_attachments_on_status_id"
t.index ["type"], name: "index_media_attachments_on_type"
end end
create_table "mentions", force: :cascade do |t| create_table "mentions", force: :cascade do |t|
@ -827,6 +833,7 @@ ActiveRecord::Schema.define(version: 2020_05_10_034822) do
t.string "unique_email" t.string "unique_email"
t.index ["account_id"], name: "index_users_on_account_id" t.index ["account_id"], name: "index_users_on_account_id"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
t.index ["created_at"], name: "index_users_on_created_at"
t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id" t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id"
t.index ["email"], name: "index_users_on_email", unique: true t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true