Sha256: 9556114f4c3373e2764a6d54a4d9ea2cd109c8b09d7a9da170a9777d992c0693

Contents?: true

Size: 1.31 KB

Versions: 13

Compression:

Stored size: 1.31 KB

Contents

class LayoutModelMigration < Migration
  def self.up(site)
    site.records.create_model :layouts do |layouts|
      add_field :name, :string, validations: {required: {}}, index: true
      add_field :mime_type, :string, validations: {required: {}}, index: true
      
      layouts.allowed_children = []
      layouts.allowed_parents = []
      layouts.searchable = false
      layouts.record_class_name = 'Layout'
    end
    
    site.layouts.create_model :persistent_layouts do |persistent_layouts|
      add_field :markup, :html, validations: {required: {}}
      add_many  :pages, foreign_key: 'page_layout_record'
      
      persistent_layouts.allowed_children = [persistent_layouts]
      persistent_layouts.allowed_parents = [persistent_layouts]
      persistent_layouts.searchable = false
      persistent_layouts.record_class_name = 'PersistentLayout'
    end
    
    site.layouts.create_model :file_layouts do |file_layouts|
      add_field :path, :string, validations: {required: {}}
      
      file_layouts.allowed_children = [file_layouts]
      file_layouts.allowed_parents = [file_layouts]
      file_layouts.searchable = false
      file_layouts.record_class_name = 'FileLayout'
    end
  end
  
  def self.down(site)
    site.layouts.destroy
    site.persistent_layouts.destroy
    site.file_layouts.destroy
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
yodel-0.0.7 lib/yodel/models/migrations/03_layout_model.rb
yodel_production_environment-0.0.7 lib/migrations/yodel/03_layout_model.rb
yodel_development_environment-0.0.7 lib/migrations/yodel/03_layout_model.rb
yodel_production_environment-0.0.4 lib/migrations/yodel/03_layout_model.rb
yodel_development_environment-0.0.4 lib/migrations/yodel/03_layout_model.rb
yodel-0.0.4 lib/yodel/models/migrations/03_layout_model.rb
yodel-0.0.3 lib/yodel/models/migrations/03_layout_model.rb
yodel_production_environment-0.0.2 lib/migrations/yodel/03_layout_model.rb
yodel_development_environment-0.0.2 lib/migrations/yodel/03_layout_model.rb
yodel-0.0.2 lib/yodel/models/migrations/03_layout_model.rb
yodel-0.0.1 lib/yodel/models/migrations/03_layout_model.rb
yodel_development_environment-0.0.1 lib/migrations/yodel/03_layout_model.rb
yodel_production_environment-0.0.1 lib/migrations/yodel/03_layout_model.rb