| Total Complexity | 1 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # frozen_string_literal: true |
||
| 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 |