Sha256: c7ed59bdfac8d0082d423539ed026a727d3a061108c6e3fe80db4dfc845c4e7a

Contents?: true

Size: 1.15 KB

Versions: 7

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_id, :assetable_type, :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

7 entries across 7 versions & 1 rubygems

Version Path
papermill-1.4.3 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.4.2 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.4.1 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.4.0 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.3.6 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.3.5 generators/papermill_table/templates/migrate/papermill_migration.rb.erb
papermill-1.3.4 generators/papermill_table/templates/migrate/papermill_migration.rb.erb