2016-06-09 08:39:16 -04:00
|
|
|
# rubocop:disable all
|
2018-11-13 02:27:31 -05:00
|
|
|
class CreateUsersStarProjects < ActiveRecord::Migration[4.2]
|
2016-11-30 10:15:02 -05:00
|
|
|
DOWNTIME = false
|
|
|
|
|
2014-06-26 03:49:14 -04:00
|
|
|
def change
|
|
|
|
create_table :users_star_projects do |t|
|
|
|
|
t.integer :project_id, null: false
|
|
|
|
t.integer :user_id, null: false
|
2016-11-28 10:45:08 -05:00
|
|
|
t.timestamps null: true
|
2014-06-26 03:49:14 -04:00
|
|
|
end
|
|
|
|
add_index :users_star_projects, :user_id
|
|
|
|
add_index :users_star_projects, :project_id
|
|
|
|
add_index :users_star_projects, [:user_id, :project_id], unique: true
|
2014-07-14 09:17:59 -04:00
|
|
|
|
|
|
|
add_column :projects, :star_count, :integer, default: 0, null: false
|
|
|
|
add_index :projects, :star_count, using: :btree
|
2014-06-26 03:49:14 -04:00
|
|
|
end
|
|
|
|
end
|