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

Support TypeORM format migrations #165

Open
fingeromer opened this issue Jun 24, 2023 · 2 comments
Open

Support TypeORM format migrations #165

fingeromer opened this issue Jun 24, 2023 · 2 comments

Comments

@fingeromer
Copy link

fingeromer commented Jun 24, 2023

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 :)

@Newbie012
Copy link
Collaborator

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.

@simplenotezy
Copy link

@fingeromer sorry for intruding here, but could you share how you've setup incremental adoption using https://safeql.dev/advanced/incremental-adoption.html? (#185)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants