Sha256: 3b999f2fed90d9c81dc802d38b49f30ebdfc3ff12075c4f2ff4c11a8ae65545e
Contents?: true
Size: 1.16 KB
Versions: 16
Compression:
Stored size: 1.16 KB
Contents
class CreateImageManager < ActiveRecord::Migration[5.0] def change create_table :image_manager_files do |t| t.string :name, null: false t.text :description t.string :copyright t.string :image_file_name t.string :image_content_type t.integer :image_file_size t.datetime :image_updated_at t.timestamps end # --------------------------------------------- create_table :image_manager_tags do |t| t.string :name, null: false t.timestamps end add_index :image_manager_tags, :name, unique: true # --------------------------------------------- create_join_table :image_manager_files, :image_manager_tags do |t| t.integer :image_manager_file_id t.integer :image_manager_tag_id end execute "ALTER TABLE image_manager_files_tags ADD PRIMARY KEY (image_manager_file_id, image_manager_tag_id)" add_foreign_key :image_manager_files_tags, :image_manager_files, on_update: :cascade, on_delete: :cascade add_foreign_key :image_manager_files_tags, :image_manager_tags, on_update: :cascade, on_delete: :cascade end end
Version data entries
16 entries across 16 versions & 1 rubygems