adonisjs / auth

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

Migration doesn't manage dependencies between schemes #145

Closed Stronautt closed 3 years ago

Stronautt commented 4 years ago

Package version

AdonisJS: 4.1.0 Auth: 3.1.0

Node.js and npm version

8.x, 10.x, 12.x

Sample Code (to reproduce the issue)

$> adonis install @adonisjs/auth
# Creates models, hooks and migrations
$> node ace migration:run --force
error: relation "users" does not exist
    at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:241:15)
    at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:89:29)
    at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:41:38)
    at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:8:42)
    at Socket.emit (events.js:310:20)
    at addChunk (_stream_readable.js:286:12)
    at readableAddChunk (_stream_readable.js:268:9)
    at Socket.Readable.push (_stream_readable.js:209:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
  length: 103,
  severity: 'ERROR',
  code: '42P01',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'namespace.c',
  line: '426',
  routine: 'RangeVarGetRelidExtended'
}

As far as I understood from the ISSUE related to the AdonisJS/Core module, schemes are migrated in alphabetical order, because of this if |token| and |user| were created with identical timestamps, it becomes impossible to perform migration due to relationship between token and user scheme.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

thetutlage commented 3 years ago

They are not created with identical timestamps anymore