Sha256: 95498ee1697e5e4e542262ccd6415f9411c2e3fe296c71131c941a8ac02ef190

Contents?: true

Size: 965 Bytes

Versions: 5

Compression:

Stored size: 965 Bytes

Contents

class CreateUploads < ActiveRecord::Migration[5.2]
  def change
    create_table :uploads do |t|
      t.string  :title,             null: false, default: nil
      t.text    :description,       null: false, default: nil
      t.boolean :sfw,               null: false, default: false
      t.boolean :published,         null: false, default: false
      t.boolean :locked,            null: false, default: false
      t.boolean :hidden_in_history, null: false, default: false

      t.references :user,     foreign_key: true
      t.references :license,  foreign_key: true
      t.references :language, foreign_key: true

      t.datetime :published_at,     null: true
      t.timestamps
    end

    create_join_table :albums, :uploads
    add_index :albums_uploads, %i[album_id upload_id], unique: true

    create_join_table :uploads, :tags
    rename_table :tags_uploads, :uploads_tags
    add_index :uploads_tags, %i[upload_id tag_id], unique: true
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
elabs-5.0.0 db/migrate/20180813000013_create_uploads.rb
elabs-4.0.0 db/migrate/20180813000013_create_uploads.rb
elabs-3.0.0 db/migrate/20180813000013_create_uploads.rb
elabs-2.0.0 db/migrate/20180813000013_create_uploads.rb
elabs-2.0.0.pre db/migrate/20180813000013_create_uploads.rb