forked from cookpad/kuroko2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alter {users,job_definitions}.id to bigint
There is the problem that some tables has different type of primary key from its installed: - before 0.2.0: using unsigned int for primary key - after 0.2.0: using signed int for primary key This problem was made by fa75b20. This makes hard to keep consistency of code / infra. For instance, we need to care about 2 types of primary when adding foreign key. Actually, this is already blocker of cookpad#110 To solve the problem, this patch proposes to alter these primary key to bigint, which is next default type of rails.
- Loading branch information
Sangyong Sim
committed
May 18, 2018
1 parent
877348f
commit 7173dcb
Showing
2 changed files
with
52 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
class AlterKeyAndIndexToBigint < ActiveRecord::Migration[5.0] | ||
def up | ||
change_column :job_definitions, :id, :bigint, auto_increment: true | ||
change_column :admin_assignments, :job_definition_id, :bigint | ||
change_column :execution_histories, :job_definition_id, :bigint | ||
change_column :executions, :job_definition_id, :bigint | ||
change_column :job_definition_tags, :job_definition_id, :bigint | ||
change_column :job_instances, :job_definition_id, :bigint | ||
change_column :job_schedules, :job_definition_id, :bigint | ||
change_column :job_suspend_schedules, :job_definition_id, :bigint | ||
change_column :memory_expectancies, :job_definition_id, :bigint | ||
change_column :stars, :job_definition_id, :bigint | ||
change_column :tokens, :job_definition_id, :bigint | ||
|
||
change_column :users, :id, :bigint, auto_increment: true | ||
change_column :admin_assignments, :user_id, :bigint | ||
change_column :stars, :user_id, :bigint | ||
end | ||
|
||
def down | ||
change_column :job_definitions, :id, :int, auto_increment: true | ||
change_column :admin_assignments, :job_definition_id, :int | ||
change_column :execution_histories, :job_definition_id, :int | ||
change_column :executions, :job_definition_id, :int | ||
change_column :job_definition_tags, :job_definition_id, :int | ||
change_column :job_instances, :job_definition_id, :int | ||
change_column :job_schedules, :job_definition_id, :int | ||
change_column :job_suspend_schedules, :job_definition_id, :int | ||
change_column :memory_expectancies, :job_definition_id, :int | ||
change_column :stars, :job_definition_id, :int | ||
change_column :tokens, :job_definition_id, :int | ||
|
||
change_column :users, :id, :int, auto_increment: true | ||
change_column :admin_assignments, :user_id, :int | ||
change_column :stars, :user_id, :int | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters