Sha256: 16d51e29a79b472716aef27a0393779795ded23048d094409887bd0786ad8749

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

class <%= migration_name %> < ActiveRecord::Migration
  def self.up
    create_table :papermill_assets do |t|
    
      # Paperclip fields (required)
      t.string   :file_file_name
      t.string   :file_content_type
      t.integer  :file_file_size
      
      # Papermill fields (required)
      t.integer  :position          # sets are ordered by position
      
      t.belongs_to :assetable, :polymorphic => true
      
      t.string   :assetable_key
      t.string   :type              # STI
      t.string   :title             # filename not transformed, without file extension, for your own use
      
      # Example additionals fields (configure :mass_editable_fields/:editable_fields accordingly)
      t.string   :alt
      t.string   :copyright
      t.text     :description
      t.timestamps
    end
    
    change_table :papermill_assets do |t|
      t.index [:assetable_type, :assetable_id, :assetable_key, :position]  
      t.index [:assetable_key, :position]  # for non assetable assets
    end
  end
  
  def self.down
    drop_table :papermill_assets
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
papermill-1.3.0 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.2.0 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.1.6 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.1.5 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.1.4 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.1.3 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.1.2 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.1.1 generators/papermill_table/templates/migrate/papermill_migration.rb.erb