Sha256: 3d8ed98882f9e2c3f0a8e1d7a534ead2ea2a92dab5265fa1b80b74e4b092fb31

Contents?: true

Size: 538 Bytes

Versions: 2

Compression:

Stored size: 538 Bytes

Contents

# frozen_string_literal: true

class CreateUsers < ActiveRecord::Migration[6.1]
  def change
    create_table(:users) do |t|
      t.string(:email, null: false)
      t.string(:password_digest, null: false)

      t.timestamps

      t.index(:email, unique: true)
    end

    change_table(:articles) do |t|
      t.references(:user, null: false, foreign_key: true)
    end

    change_table(:comments) do |t|
      t.remove(:author, type: :string, null: false)
      t.references(:user, null: false, foreign_key: true)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
upgrow-0.0.5 test/dummy/db/migrate/20210409164927_create_users.rb
upgrow-0.0.4 test/dummy/db/migrate/20210409164927_create_users.rb