adonisjs / auth

Official Authentication package for AdonisJS
https://docs.adonisjs.com/guides/auth/introduction
MIT License
191 stars 65 forks source link

change properties password and remeber_me_token to optional in types #147

Closed Disbot-lab closed 3 years ago

Disbot-lab commented 4 years ago

To use auth without a password, the password and remember_me_token fields should be optional.

Package version

4.3.1

Node.js and npm version

Node v14.7.0 Npm v6.14.7

Sample Code (to reproduce the issue)

import BaseSchema from '@ioc:Adonis/Lucid/Schema'

export default class UsersSchema extends BaseSchema {
  protected tableName = 'users'

  public async up () {
    this.schema.createTable(this.tableName, (table) => {
      table.uuid('id').primary().defaultTo(this.db.rawQuery("uuid_generate_v4()").knexQuery)
      table.string('email', 255).notNullable()
      table.string('password', 180).notNullable() //FIXME: Should be optional
      table.string('remember_me_token').nullable() // FIXME: Should be optional
      table.timestamps(true)
    })
  }

  public async down () {
    this.schema.dropTable(this.tableName)
  }
}
thetutlage commented 4 years ago

The migration is created in your source code and hence you can manually change notNullable to nullable

thetutlage commented 3 years ago

Closing since no response from the issue reporter and not actionable as well