2017-09-10 17:25:29 +05:30
|
|
|
# rubocop:disable Migration/Timestamps
|
2019-02-15 15:39:39 +05:30
|
|
|
class CreateTimelogsCe < ActiveRecord::Migration[4.2]
|
2017-08-17 22:00:37 +05:30
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
def up
|
|
|
|
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
|
|
|
|
|
|
|
|
def down
|
|
|
|
drop_table :timelogs if table_exists?(:timelogs)
|
|
|
|
end
|
|
|
|
end
|