Class: CreateBlobs

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/laserblob/install/templates/create_blobs.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/laserblob/install/templates/create_blobs.rb', line 2

def change
  create_table :blobs, id: :uuid do |t|
    t.string :type, default: 'LaserBlob::Blob'
    t.bigint :size, null: false
    t.string :content_type, null: false
    t.jsonb :metadata, default: {}
    t.binary :sha1, limit: 20, null: false

    t.timestamps
  end

  add_index :blobs, :sha1
  add_index :blobs, [:type, :sha1]
end