Class: CreateRubyCmsContentBlocks

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/ruby_cms/templates/db/migrate/20260125000003_create_ruby_cms_content_blocks.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/ruby_cms/templates/db/migrate/20260125000003_create_ruby_cms_content_blocks.rb', line 4

def change
  create_table :ruby_cms_content_blocks, if_not_exists: true do |t|
    t.string :key, null: false
    t.string :title
    t.text :content
    t.string :content_type, default: "text", null: false
    t.boolean :published, default: false, null: false
    t.references :updated_by, null: true, foreign_key: false

    t.timestamps
  end

  add_index :ruby_cms_content_blocks, :key, unique: true, if_not_exists: true
  add_index :ruby_cms_content_blocks, %i[published content_type], if_not_exists: true
end