-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[cost center] put all costcenter access behind API #12776
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (c) 2022 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"; | ||
import { columnExists } from "./helper/helper"; | ||
|
||
const D_B_COST_CENTER = "d_b_cost_center"; | ||
const COL_CREATION_TIME = "creationTime"; | ||
const COL_BILLING_STRATEGY = "billingStrategy"; | ||
|
||
export class CostCenterPaymentStrategy1662639748206 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
if (!(await columnExists(queryRunner, D_B_COST_CENTER, COL_CREATION_TIME))) { | ||
await queryRunner.query( | ||
`ALTER TABLE ${D_B_COST_CENTER} ADD COLUMN ${COL_CREATION_TIME} varchar(30) NOT NULL, ALGORITHM=INPLACE, LOCK=NONE `, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they will be filled up with the implicit default value for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, true. That was not my intend, but I think it will not break. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm actually not sure what MYSQL will do with existing records here 😬 The migration worked well against an empty table. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Just verified that this is the case indeed |
||
); | ||
await queryRunner.query( | ||
`ALTER TABLE ${D_B_COST_CENTER} ADD COLUMN ${COL_BILLING_STRATEGY} varchar(255) NOT NULL DEFAULT 'other', ALGORITHM=INPLACE, LOCK=NONE `, | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE ${D_B_COST_CENTER} DROP PRIMARY KEY, ADD PRIMARY KEY(id, ${COL_CREATION_TIME}), ALGORITHM=INPLACE, LOCK=NONE `, | ||
); | ||
} | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> {} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.