Module: Dragonfly::ActiveRecord::Migration

Defined in:
lib/dragonfly-activerecord/migration.rb

Instance Method Summary collapse

Instance Method Details

#downObject



21
22
23
24
# File 'lib/dragonfly-activerecord/migration.rb', line 21

def down
  drop_table :storage_chunks
  drop_table :storage_files
end

#upObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dragonfly-activerecord/migration.rb', line 5

def up
  create_table :storage_chunks do |t|
    t.integer :file_id
    t.integer :idx
    t.binary  :encoded_data, limit: 65_536
  end

  add_index :storage_chunks, :file_id, using: 'hash'

  create_table :storage_files do |t|
    t.text     :metadata
    t.datetime :accessed_at
    t.timestamps
  end
end