Class: SnippetModelMigration
- Inherits:
-
Migration
show all
- Defined in:
- lib/yodel/models/migrations/06_snippet_model.rb
Class Method Summary
collapse
Methods inherited from Migration
copy_missing_migrations_for_all_sites, copy_missing_migrations_for_site, inherited, run_migrations, run_migrations_for_all_sites
Class Method Details
.down(site) ⇒ Object
11
12
13
|
# File 'lib/yodel/models/migrations/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/yodel/models/migrations/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
|