Support TypeORM format migrations
Today SafeQL supports only raw SQL migration files. (In the migrationsDir)
As a TypeORM user, I would like to also have a support of TS migrations files. Their structure simple:
import { MigrationInterface, QueryRunner } from 'typeorm';
export class MigrationTIMESTAMP implements MigrationInterface {
name = 'MigrationsTIMESTAMP';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "foo" ADD "bar" boolean NOT NULL DEFAULT false`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "foo" DROP COLUMN "bar"`);
}
}
My team would also like to help and contribute to this project by developing this feature :)
I'm working on something that should help integrate libraries-specific syntax (such as SQL fragments). Maybe I should widen it so each integration will be able to handle its own migration logic as well.
@fingeromer sorry for intruding here, but could you share how you've setup incremental adoption using https://safeql.dev/advanced/incremental-adoption.html? (https://github.com/ts-safeql/safeql/issues/185)