2017-06-13 07:44:13 -04:00
|
|
|
# rubocop:disable Migration/Timestamps
|
2018-11-13 02:27:31 -05:00
|
|
|
class CreateTimelogsCe < ActiveRecord::Migration[4.2]
|
2017-01-19 12:32:10 -05:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2017-01-24 11:12:55 -05:00
|
|
|
def up
|
2017-01-19 12:32:10 -05:00
|
|
|
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
|
2017-01-24 11:12:55 -05:00
|
|
|
|
|
|
|
def down
|
|
|
|
drop_table :timelogs if table_exists?(:timelogs)
|
|
|
|
end
|
2017-01-19 12:32:10 -05:00
|
|
|
end
|