Class: CreateAssets

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/uploader/install/templates/20130905144515_create_assets.rb

Class Method Summary collapse

Class Method Details

.downObject



31
32
33
# File 'lib/generators/uploader/install/templates/20130905144515_create_assets.rb', line 31

def self.down
  drop_table :assets
end

.upObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/uploader/install/templates/20130905144515_create_assets.rb', line 4

def self.up
  create_table :assets do |t|
    t.string  :data_file_name, null: false
    t.string  :data_content_type
    t.integer :data_file_size

    t.integer :assetable_id, null: false
    t.string  :assetable_type, limit: 30, null: false
    t.string  :type, limit: 30

    t.string  :guid, limit: 30
    t.string  :public_token, limit: 30

    t.integer :user_id
    t.integer :sort_order, default: 0
    t.integer :width
    t.integer :height

    t.timestamps
  end

  add_index :assets, [:assetable_type, :type, :assetable_id]
  add_index :assets, :user_id
  add_index :assets, :guid
  add_index :assets, :public_token
end