feat: CRUD operation for associated articles to current article (#4912)
This commit is contained in:
5
db/migrate/20220608084622_add_associated_article_id.rb
Normal file
5
db/migrate/20220608084622_add_associated_article_id.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddAssociatedArticleId < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_reference :articles, :associated_article, foreign_key: { to_table: :articles }
|
||||
end
|
||||
end
|
||||
12
db/migrate/20220628124837_create_portal_members.rb
Normal file
12
db/migrate/20220628124837_create_portal_members.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class CreatePortalMembers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :portal_members do |t|
|
||||
t.bigint :portal_id
|
||||
t.bigint :user_id
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :portal_members, [:portal_id, :user_id], unique: true
|
||||
add_index :portal_members, [:user_id, :portal_id], unique: true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user