2018-03-01 09:42:04 -05:00
|
|
|
class CreateUserInteractedProjectsTable < ActiveRecord::Migration
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2018-03-13 13:10:53 -04:00
|
|
|
INDEX_NAME = 'user_interacted_projects_non_unique_index'
|
2018-03-01 09:42:04 -05:00
|
|
|
|
|
|
|
def up
|
|
|
|
create_table :user_interacted_projects, id: false do |t|
|
|
|
|
t.references :user, null: false
|
|
|
|
t.references :project, null: false
|
|
|
|
end
|
2018-03-13 13:10:53 -04:00
|
|
|
|
|
|
|
add_index :user_interacted_projects, [:project_id, :user_id], name: INDEX_NAME
|
2018-03-01 09:42:04 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
drop_table :user_interacted_projects
|
|
|
|
end
|
|
|
|
end
|