diff options
author | alpaca-tc <alpaca-tc@alpaca.tc> | 2017-05-08 02:00:20 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-07 19:00:20 +0200 |
commit | d3704fdb09d79279c8dfde591087aa723af29891 (patch) | |
tree | 699f9f3296e8aee1778da69ace3ac1bc570ba1c9 /db/migrate | |
parent | ca05bfaac7894285bf9ebbfeebe8c379b94eeb42 (diff) |
Add effective index to subscriptions (#2885)
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20170507141759_optimize_index_subscriptions.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/db/migrate/20170507141759_optimize_index_subscriptions.rb b/db/migrate/20170507141759_optimize_index_subscriptions.rb new file mode 100644 index 000000000..26acd5c4d --- /dev/null +++ b/db/migrate/20170507141759_optimize_index_subscriptions.rb @@ -0,0 +1,11 @@ +class OptimizeIndexSubscriptions < ActiveRecord::Migration[5.0] + def up + add_index :subscriptions, [:account_id, :callback_url], unique: true + remove_index :subscriptions, [:callback_url, :account_id] + end + + def down + add_index :subscriptions, [:callback_url, :account_id], unique: true + remove_index :subscriptions, [:account_id, :callback_url] + end +end |