Sha256: ee75fe41279fdbaad4a7aef920d3f03b7b701fc823cc0e9d9ebf44876e7cfaa4

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

class CreatePandaCMSPosts < ActiveRecord::Migration[7.1]
  def change
    create_table :panda_cms_post_tags, id: :uuid do |t|
      t.string :tag
      t.string :description
      t.string :slug
      t.timestamps
      t.index :tag, unique: true
      t.index :slug, unique: true
    end

    create_table :panda_cms_posts, id: :uuid do |t|
      t.string :title
      t.string :slug
      t.text :content
      t.datetime :published_at
      t.references :post_tag, type: :uuid, null: false, foreign_key: {to_table: :panda_cms_post_tags}
      t.references :user, type: :uuid, null: false, foreign_key: {to_table: :panda_cms_users}
      t.timestamps
      t.index :slug, unique: true
    end

    create_enum :panda_cms_post_status, ["active", "draft", "hidden", "archived"]
    add_column :panda_cms_posts, :status, :panda_cms_post_status, default: "draft", null: false
    add_index :panda_cms_posts, :status
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
panda-cms-0.7.3 db/migrate/20240805121123_create_panda_cms_posts.rb
panda-cms-0.7.2 db/migrate/20240805121123_create_panda_cms_posts.rb
panda-cms-0.7.0 db/migrate/20240805121123_create_panda_cms_posts.rb