diff options
author | Rémy Coutable <remy@rymai.me> | 2017-01-19 20:32:10 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-01-20 00:02:45 +0300 |
commit | 2bf5fe5edead9ec59e3a9a3bac3ed3eb1601ba41 (patch) | |
tree | 1852dbd90533954f34a6b55466a7692883cf09ed /db/migrate/20161223034646_create_timelogs_ce.rb | |
parent | 4bf9725035f20e3a571a3fc9bda273f3bdd3cbbe (diff) |
Rename duplicate migrations and skip them if table/columns are already present
The time tracking feature was backported from EE to CE, thus the CE
migrations should be uniquely named and should skip the actual migration
content if the table/columns already exist (that means that the EE
migrations were already performed).
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'db/migrate/20161223034646_create_timelogs_ce.rb')
-rw-r--r-- | db/migrate/20161223034646_create_timelogs_ce.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20161223034646_create_timelogs_ce.rb b/db/migrate/20161223034646_create_timelogs_ce.rb new file mode 100644 index 00000000000..e8a4b406012 --- /dev/null +++ b/db/migrate/20161223034646_create_timelogs_ce.rb @@ -0,0 +1,20 @@ +class CreateTimelogsCe < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + unless table_exists?(:timelogs) + create_table :timelogs do |t| + t.integer :time_spent, null: false + t.references :trackable, polymorphic: true + t.references :user + + t.timestamps null: false + end + + add_index :timelogs, [:trackable_type, :trackable_id] + add_index :timelogs, :user_id + end + end +end |