Add posts, tags, tagging, to database. Create references to align with new DB model. Add image of mermaid template model.
This commit is contained in:
parent
4edae5e7bb
commit
8ee5dd9322
17 changed files with 154 additions and 2 deletions
14
db/migrate/20250515134517_create_posts.rb
Normal file
14
db/migrate/20250515134517_create_posts.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class CreatePosts < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :posts do |t|
|
||||
t.string :title
|
||||
t.text :content
|
||||
t.boolean :pinned
|
||||
t.references :user, null: false, foreign_key: true
|
||||
t.references :image, null: false, foreign_key: true
|
||||
t.string :type
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
10
db/migrate/20250515134851_create_tags.rb
Normal file
10
db/migrate/20250515134851_create_tags.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class CreateTags < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :tags do |t|
|
||||
t.string :title
|
||||
t.string :color
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
10
db/migrate/20250515135623_create_taggings.rb
Normal file
10
db/migrate/20250515135623_create_taggings.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class CreateTaggings < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :taggings do |t|
|
||||
t.references :tag, null: false, foreign_key: true
|
||||
t.references :taggable, polymorphic: true, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue