Sha256: ef501bb8b962dd45d08860e269cf9f985fa078f546eee20f8d2e709afc42552c

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

class EnjoyGalleryCreateGallery < ActiveRecord::Migration
  def change
    ########### c #################
    create_table :enjoy_gallery_gallery_images do |t|
      t.integer :gallery_id
      t.integer :enjoy_gallery_imagable_id
      t.string :enjoy_gallery_imagable_type

      t.boolean :enabled, default: true, null: false

      if Enjoy::Gallery.config.localize
        t.column :name_translations, 'hstore', default: {}
      else
        t.string :name, null: false
      end

      t.attachment :image
      t.timestamps
    end

    add_index :enjoy_gallery_gallery_images, [:enabled]
    add_index :enjoy_gallery_gallery_images, [:gallery_id]
    add_index :enjoy_gallery_gallery_images, [:enjoy_gallery_imagable_id, :enjoy_gallery_imagable_type]



    ########### Galleries #################
    create_table :enjoy_gallery_gallery do |t|
      t.boolean :enabled, default: true, null: false

      if Enjoy::Gallery.config.localize
        t.column :name_translations, 'hstore', default: {}
      else
        t.string :name, null: false
      end

      t.integer :parent_id
      t.integer :lft
      t.integer :rgt
      t.integer :depth

      t.string :slug, null: false
      t.attachment :image
      t.timestamps
    end

    add_index :enjoy_gallery_galleries, :slug, unique: true
    add_index :enjoy_gallery_galleries, [:enabled, :lft]

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
enjoy_cms_gallery-0.4.1 lib/generators/enjoy/gallery/migrations/templates/migration_gallery.rb
enjoy_cms_gallery-0.4.0.2 lib/generators/enjoy/gallery/migrations/templates/migration_gallery.rb
enjoy_cms_gallery-0.4.0.1 lib/generators/enjoy/gallery/migrations/templates/migration_gallery.rb
enjoy_cms_gallery-0.4.0 lib/generators/enjoy/gallery/migrations/templates/migration_gallery.rb
enjoy_cms_gallery-0.4.0.beta3 lib/generators/enjoy/gallery/migrations/templates/migration_gallery.rb
enjoy_cms_gallery-0.4.0.beta1 lib/generators/enjoy/gallery/migrations/templates/migration_gallery.rb