jackson/npm/migration/mssql/1692767993709-mss_namespace.ts

17 lines
698 B
TypeScript
Raw Normal View History

Feature/typeorm migrations (#141) * updated typeorm * renamed connection * updated migration scripts to new TypeORM version (v3) * typeorm and mongo -migrations and namespace column * update the mongo migration file * remove the camelcase * remove camelcase * rename the file * renaming migration files * folder restructuring and add migrate-mongo package * correcting path and minor changes * merging db name with URL * changing ts to js for mongo * migration automation with env variable * using custom scripts for migration * Dockerfile fixes * bootstrap script fixes and still need ts-node migrate-mongo in dockerfile * running migration in CI/CD * turning down planetscale * migration related fixes for namespace * Migration & bootstrap changes * reverting minor change * bootstrap.sh will only run in docker env * bootstrap RUN_MIGRATION env variable will use true * migration fixes * migration changes * removed console logs * planetscale migration fixes * copied back old files, tweaks to filenames * add index for namespace * restore older migration scripts * formatting * aligned timestamps * updated mysql, mariadb, mssql, planetscale namespace migrations * We'll run migrate manually as a separate step/container * forgot to add migrate.sh * bumped up timestamp * Enable planetscale testing * Revert planetscale test and comment config object * Revert deletions in Dockerfile * Update maria, mssql, mysql, ps, pg, sql namespace migrations * Cleanup * Add runMigration env to support manual run * Minor tweak * Ensure sql data migrations run after schema changes * Fix mssql namespace data migration query * Sync lock file * Update mongo timestamp * Set env for npm mongo migration script * [sql] Populate namespace column for synchronize: true instances * Rename `DB_RUN_MIGRATION` -> `DB_MANUAL_MIGRATION` * [mongo] Populate namespace for already deployed instances * Cleanup migrate.sh * [bash -> sh] bash does not work inside docker * Optimise migration artifacts * Source packages from global path * Copy npm from build context - excludes node_modules via .dockerignore * Remove redundant copy step * added swc packages * fresh package-lock * fresh package-lock * added migratepg job to skaffold fixes in migrate.sh to exit with error when migration fails * cleanup * added migratepg to demo skaffold as well * turn on planetscale tests --------- Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Utkarsh Mehta <ukrocks.mehta@gmail.com> Co-authored-by: Aswin V <vaswin91@gmail.com>
2023-10-13 22:29:21 +00:00
import { MigrationInterface, QueryRunner } from "typeorm";
export class MssNamespace1692767993709 implements MigrationInterface {
name = 'MssNamespace1692767993709'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "jackson_store" ADD "namespace" varchar(64)`);
await queryRunner.query(`CREATE INDEX "_jackson_store_namespace" ON "jackson_store" ("namespace") `);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "_jackson_store_namespace" ON "jackson_store"`);
await queryRunner.query(`ALTER TABLE "jackson_store" DROP COLUMN "namespace"`);
}
}