Skip to content

Fixed default table name in migration file - #274

Merged
joshbuker merged 1 commit into
Sorcery:masterfrom
linyclar:fix-default-table-name
Mar 18, 2021
Merged

joshbuker merged 1 commit into
Sorcery:masterfrom
linyclar:fix-default-table-name

Conversation

@linyclar

Copy link
Copy Markdown
Contributor

The generated result of bin/rails g sorcery:install command is incorrect.

Current generated table name is User, but correct table name is users.

Current generated result

class SorceryCore < ActiveRecord::Migration[6.1]
  def change
    create_table :User do |t|
      t.string :email,            null: false
      t.string :crypted_password
      t.string :salt

      t.timestamps                null: false
    end

    add_index :User, :email, unique: true
  end
end

Generated result after modification

class SorceryCore < ActiveRecord::Migration[6.1]
  def change
    create_table :users do |t|
      t.string :email,            null: false
      t.string :crypted_password
      t.string :salt

      t.timestamps                null: false
    end

    add_index :users, :email, unique: true
  end
end

@joshbuker joshbuker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah looks like this was overlooked when the ability to use name-spaced models was added. Good catch!

I need to fix the CI integrations being borked, but this looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants