Skip to content

v0.5.0

Compare
Choose a tag to compare
@anchan828 anchan828 released this 11 May 17:34
· 408 commits to main since this release

Repeatable Migrations

This is a feature to support migrations that need to be regenerated multiple times, such as views/functions/triggers/etc. Unlike migrations that are executed only once, it compares the checksum of the SQL to be executed to determine the need for migration.

KyselyModule.register({
  dialect: createDialect(),
  repeatableMigrations: {
    migrationsRun: true,
    migratorProps: {
      provider: new KyselyRepeatableMigrationSqlFileProvider({
        sqlFiles: [resolve(__dirname, "user-view.sql")],
        sqlTexts: [{ name: "test", sql: "SELECT 1;" }],
      }),
    },
  },
});
name hash timestamp
user-view 6c7e36422f79696602e19079534b4076 2024-05-11T17:04:20.211Z
test e7d6c7d4d9b1b0b4c7f5d7b3d5e9d4d4 2024-05-11T17:04:20.211Z

Note

  • Once the file is renamed, the migration is executed even if the contents have not changed.
  • Views/Functions/Triggers created by Repeatable Migration are not automatically deleted (or update/rename) by simply deleting the corresponding SQL, so please delete them using the normal migration function.