# 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