Class: SnippetModelMigration

Inherits:
Migration
  • Object
show all
Defined in:
lib/migrations/yodel/06_snippet_model.rb

Class Method Summary collapse

Class Method Details

.down(site) ⇒ Object



11
12
13
# File 'lib/migrations/yodel/06_snippet_model.rb', line 11

def self.down(site)
  site.snippets.destroy
end

.up(site) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/migrations/yodel/06_snippet_model.rb', line 2

def self.up(site)
  site.records.create_model :snippets do |snippets|
    add_field :name, :string, validations: {required: {}}, index: true
    add_field :show_in_search, :boolean, default: false, display: false
    add_field :content, :text
    snippets.searchable = false
  end
end