Skip to content
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

bug: missing migration file does not cause a failure #9

Open
jousby opened this issue Jul 24, 2024 · 1 comment
Open

bug: missing migration file does not cause a failure #9

jousby opened this issue Jul 24, 2024 · 1 comment
Labels
bug Something isn't working fixed A fix has been committed

Comments

@jousby
Copy link

jousby commented Jul 24, 2024

I've got the following code for running a test of my migrations:

    it(
      'should apply the placeholder 1.0.0 migration',
      async () => {
        const migrate = new Migrate(
          {
            client: localDynamoDB.dynamodbClient,
            name: tableName,
            schema: AssetSchema_1_0_0,
            partial: true,
          },
          { dir: './src/dao/migrations' },
        )
        await migrate.init()
        await migrate.apply('up', '1.0.0', { dry: false })
      },
      timeoutMilliseconds,
    )

when

        await migrate.apply('up', '1.0.0', { dry: false })

runs it goes looking for a file called 1.0.0.js in ./src/dao/migrations. If this file is not present the apply command returns successfully after logging:

   [
     'Run migration "up"',
     { action: 'up', versions: [ ], version: '1.0.0' }
   ]

I think a more helpful response here is that if you try to apply a '1.0.0' migration and it doesn't find a file or inline migration for that version it should throw.

@mobsense mobsense added the bug Something isn't working label Jul 28, 2024
@mobsense
Copy link

mobsense commented Aug 6, 2024

The apply routine for up and down was applying all intermediate migrations and was stopping when no more migrations were found for the target version. It was not checking if that version was actually found.

Will apply a fix for this.

thanks for reporting

@mobsense mobsense reopened this Aug 6, 2024
@mobsense mobsense added the fixed A fix has been committed label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed A fix has been committed
Projects
None yet
Development

No branches or pull requests

2 participants