关注列表/点赞列表/fork列表的后端

This commit is contained in:
sylor_huang@126.com
2020-05-15 17:05:53 +08:00
parent cf20cc3a0b
commit 46c929a394
12 changed files with 87 additions and 2 deletions

View 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

View 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