Closed JAWS-tm closed 2 weeks ago
That's the expected behavior. You never await
the statements within the migration class, since that is done by the Migration runner behind the scenes.
By not awaiting
right away we are able to support the dry run behavior using the --dry-run
flag. In dry run, the queries are not executed and instead their corresponding SQL is displayed in the output
Package version
20.6.0
Describe the bug
Including
await
in a migration file when creating or altering a table schema results in unexpected errors. Specifically, even if the table or column does not exist, running the migration fails with a message indicating that the column already exists.Example for Reproduction:
The following code should create a new table,
test_table
, with a single columncolumn_name
. However, using await in the up method causes an error.When running this migration, the following error occurs:
If
await
is removed, the migration works correctly, creating the table and column without errors.Expected Behavior:
With
await
in the migration, the table and column should be created, and no errors about existing columns should be thrown.Actual Behavior:
The migration fails with an error stating that the column already exists, even when it does not.
Environment:
Database: PostgreSQL Node.js version: v20.11.0 Adonis Lucid version:: 20.6.0
Reproduction repo
No response