Path: blob/main/components/gitpod-db/src/migrate-migrations.ts
2498 views
/**1* Copyright (c) 2021 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/56import { TypeORM } from "./typeorm/typeorm";7import { Config } from "./config";8import { MigrateMigrations0_2_0 } from "./typeorm/migrate-migrations-0_2_0";9import { log } from "@gitpod/gitpod-protocol/lib/util/logging";1011async function migrateMigrationsTable() {12const config = new Config();13const typeorm = new TypeORM(config, {});14const conn = await typeorm.getConnection();1516const runner = conn.createQueryRunner();17const migration_0_2_0 = new MigrateMigrations0_2_0();18await migration_0_2_0.up(runner);1920conn.close().catch((err) => log.error("cannot close connection", err));21console.log("successfully migrated 'migrations' table.");22}2324migrateMigrationsTable().catch((err) => {25console.error(err);26process.exit(1);27});282930