Sha256: 22714c23695a74a64b10e1de07fb4dd276b264c5a77126a64cf794c1ee292e84

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 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         # Content can be used to add copyright on thumbnails
      t.text     :description
      t.timestamps
    end
    
    change_table :papermill_assets do |t|
      t.index [:assetable_type, :assetable_id, :assetable_key, :position], { :name => "papermill_index" }
      t.index [:assetable_key, :position]  # for non assetable assets
    end
  end
  
  def self.down
    drop_table :papermill_assets
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
papermill-1.3.3 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.3.2 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.3.1 generators/papermill_table/templates/migrate/papermill_migration.rb.erb