Skip to content

[example] replace flask example #3740

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

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
* Licensed under the GNU Affero General Public License (AGPL).
* See License-AGPL.txt in the project root for license information.
*/

import {MigrationInterface, QueryRunner} from "typeorm";

export class UpdateFlask1617617125217 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<any> {
const toDelete = [
'https://github.com/breatheco-de/python-flask-api-tutorial'
];
const newEntries = [
{ url: 'https://github.com/gitpod-io/python-flask-example', description: 'The official example from Flask', priority: 40 },
]
// delete old entries
await queryRunner.query(`DELETE FROM d_b_repository_white_list where url in (${toDelete.map(e => '?').join(', ')})`, toDelete);
const insert = `INSERT IGNORE INTO d_b_repository_white_list (url, description, priority) VALUES ${newEntries.map(e=>'(?, ?, ?)').join(', ')}`;
const values: any[] = [];
for (const e of newEntries) {
values.push(e.url, e.description, e.priority);
}
await queryRunner.query(insert, values);
}

public async down(queryRunner: QueryRunner): Promise<any> {
}

}