module Dragonfly::ActiveRecord::Migration

Public Instance Methods

down() click to toggle source
# File lib/dragonfly-activerecord/migration.rb, line 21
def down
  drop_table :storage_chunks
  drop_table :storage_files
end
up() click to toggle source
# 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