Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-db/src/migrate-migrations.ts
2498 views
1
/**
2
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { TypeORM } from "./typeorm/typeorm";
8
import { Config } from "./config";
9
import { MigrateMigrations0_2_0 } from "./typeorm/migrate-migrations-0_2_0";
10
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
11
12
async function migrateMigrationsTable() {
13
const config = new Config();
14
const typeorm = new TypeORM(config, {});
15
const conn = await typeorm.getConnection();
16
17
const runner = conn.createQueryRunner();
18
const migration_0_2_0 = new MigrateMigrations0_2_0();
19
await migration_0_2_0.up(runner);
20
21
conn.close().catch((err) => log.error("cannot close connection", err));
22
console.log("successfully migrated 'migrations' table.");
23
}
24
25
migrateMigrationsTable().catch((err) => {
26
console.error(err);
27
process.exit(1);
28
});
29
30