-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI create: "Expected to be a pending migration but it wasn't!" when using create.template name transformation #559
Comments
This warning isn't so much about the file failing to be created, but about it not being picked up by your |
It is. $ npx ts-node --files -- src/cli "create" "--name" "asdfQWER"
{
event: 'created',
path: 'REDACTED/src/migrations/2022.08.12t19.04.33.asdfqwer.m.ts'
}
Error: Expected REDACTED/src/migrations/2022.08.12T19.04.33.asdfQWER to be a pending migration but it wasn't! You should investigate this. Use --skip-verify to bypass this error.
$ npx ts-node --files -- src/cli pending
2022.06.03T08.13.57.example.m
2022.08.12t19.04.33.asdfqwer.m |
Release v3.2.1 addresses this. |
@kf6kjg fixed in the release above. Note that the code snippet you posted has a bug though and may still hit the warning - you are calling template: (filepath): [string, string][] => {
+ const parsed = path.parse(filepath);
return [
[
- `${filepath.toLowerCase()}.m.ts`,
+ `${path.join(parsed.dir, parsed.base.toLowerCase())}.m.ts`,
`import { DataTypes, QueryInterface } from "sequelize"; |
Oooh! Excellent catch and excellent that the error is fixed! Thank you. |
Looks like Umzug isn't handling the renaming of the inbound filename terribly well. I could make the "error" go away by adding the flag it mentions, but that just masks the problem.
Environment
Umzug 3.1.1
SequelizeStorage
Node 16 & 18
TypeScript, CommonJS
Relevant code snippet
Example execution
The file gets created, so this is more of a warning than an actual error, but it does cause confusion for the team members.
The text was updated successfully, but these errors were encountered: