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:
hannah.dagemark 2025-05-15 16:35:29 +02:00 committed by Hannah Dagemark
commit 8ee5dd9322
17 changed files with 154 additions and 2 deletions

View 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

View 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

View 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