mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
关注列表/点赞列表/fork列表的后端
This commit is contained in:
6
db/migrate/20200515080705_add_created_at_to_watcher.rb
Normal file
6
db/migrate/20200515080705_add_created_at_to_watcher.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class AddCreatedAtToWatcher < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :watchers, :created_at, :datetime
|
||||
Watcher.update_all(created_at: Time.current)
|
||||
end
|
||||
end
|
||||
17
db/migrate/20200515082628_create_fork_users.rb
Normal file
17
db/migrate/20200515082628_create_fork_users.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class CreateForkUsers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :fork_users do |t|
|
||||
t.integer :project_id #原始项目id
|
||||
t.integer :fork_project_id #fork后的项目id
|
||||
t.integer :user_id #fork用户的id
|
||||
t.timestamps
|
||||
end
|
||||
add_index :fork_users, :project_id
|
||||
add_index :fork_users, :user_id
|
||||
|
||||
projects = Project.where.not(forked_from_project_id: [nil, ""])
|
||||
projects.each do |p|
|
||||
ForkUser.create(project_id: p.forked_from_project_id, fork_project_id: p.id, user_id: p.user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user