[deploy] Optimization:Change Role PKs from Int to Bigint (#9403)
This commit is contained in:
parent
1b22cdd1c9
commit
c99cd29eb2
2 changed files with 18 additions and 3 deletions
15
db/migrate/20200720143134_change_role_p_kto_bigint.rb
Normal file
15
db/migrate/20200720143134_change_role_p_kto_bigint.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
class ChangeRolePKtoBigint < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
safety_assured {
|
||||
change_column :roles, :id, :bigint
|
||||
change_column :users_roles, :role_id, :bigint
|
||||
}
|
||||
end
|
||||
|
||||
def down
|
||||
safety_assured {
|
||||
change_column :roles, :id, :int
|
||||
change_column :users_roles, :role_id, :int
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_07_19_205123) do
|
||||
ActiveRecord::Schema.define(version: 2020_07_20_143134) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
@ -977,7 +977,7 @@ ActiveRecord::Schema.define(version: 2020_07_19_205123) do
|
|||
t.index ["user_id"], name: "index_response_templates_on_user_id"
|
||||
end
|
||||
|
||||
create_table "roles", id: :serial, force: :cascade do |t|
|
||||
create_table "roles", force: :cascade do |t|
|
||||
t.datetime "created_at"
|
||||
t.string "name"
|
||||
t.integer "resource_id"
|
||||
|
|
@ -1297,7 +1297,7 @@ ActiveRecord::Schema.define(version: 2020_07_19_205123) do
|
|||
end
|
||||
|
||||
create_table "users_roles", id: false, force: :cascade do |t|
|
||||
t.integer "role_id"
|
||||
t.bigint "role_id"
|
||||
t.integer "user_id"
|
||||
t.index ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue