Passed
Push — master ( 33ca92...23b088 )
by Ahmad
10:28
created

CreateActiveStorageTables   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 0 24 1
1
# frozen_string_literal: true
2
3
# This migration comes from active_storage (originally 20170806125915)
4
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
5
  def change
6
    create_table :active_storage_blobs do |t|
7
      t.string   :key,        null: false
8
      t.string   :filename,   null: false
9
      t.string   :content_type
10
      t.text     :metadata
11
      t.bigint   :byte_size,  null: false
12
      t.string   :checksum,   null: false
13
      t.datetime :created_at, null: false
14
15
      t.index [:key], unique: true
16
    end
17
18
    create_table :active_storage_attachments do |t|
19
      t.string     :name,     null: false
20
      t.references :record,   null: false, polymorphic: true, index: false
21
      t.references :blob,     null: false
22
23
      t.datetime :created_at, null: false
24
25
      t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true
26
      t.foreign_key :active_storage_blobs, column: :blob_id
27
    end
28
  end
29
end
30