Sha256: e4c57f6ccea9e0f6ed5247fb6d94d881b2770fe9f1974dc7ffef7ce877758c1b

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

class CreateEffectiveAssets < ActiveRecord::Migration
  def self.up
    create_table <%= @assets_table_name %> do |t|
      t.string  :title
      t.text    :description
      t.string  :tags

      t.integer :user_id

      t.string  :content_type
      t.string  :upload_file
      t.string  :data
      t.boolean :processed, :default => false

      t.integer :data_size
      t.integer :height
      t.integer :width
      t.text    :versions_info

      t.timestamps
    end

    add_index <%= @assets_table_name %>, :content_type

    create_table <%= @attachments_table_name %> do |t|
      t.integer :asset_id
      t.string  :attachable_type
      t.integer :attachable_id
      t.integer :position
      t.string  :box
    end

    add_index <%= @attachments_table_name %>, :asset_id
    add_index <%= @attachments_table_name %>, [:attachable_type, :attachable_id]
    add_index <%= @attachments_table_name %>, :attachable_id
  end

  def self.down
    drop_table <%= @assets_table_name %>
    drop_table <%= @attachments_table_name %>
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_assets-0.1 db/migrate/01_create_effective_assets.rb.erb