gitlab-org--gitlab-foss/db/migrate/20161223034646_create_timelogs_ce.rb
Rémy Coutable 929c20c2bc
Make the time estimate migrations reversible
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-24 17:15:37 +01:00

24 lines
547 B
Ruby

class CreateTimelogsCe < ActiveRecord::Migration
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