-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[usage] Rename misnamed column in usage table #11353
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
Conversation
started the job as gitpod-build-af-rename-misnamed-column.4 because the annotations in the pull request description changed |
components/gitpod-db/src/typeorm/migration/1657722262390-RenameWorkspaceIdColumn.ts
Show resolved
Hide resolved
await queryRunner.query(`DROP TABLE \`d_b_workspace_instance_usage\``); | ||
|
||
await queryRunner.query( | ||
`CREATE TABLE \`d_b_workspace_instance_usage\` (\`instanceId\` char(36) NOT NULL, \`attributionId\` varchar(255) NOT NULL, \`startedAt\` timestamp(6) NOT NULL, \`stoppedAt\` timestamp(6) NULL, \`creditsUsed\` double NOT NULL, \`generationId\` int NOT NULL, \`deleted\` tinyint NOT NULL, INDEX \`IDX_1358af969a29fd9e0c6cabf37c\` (\`attributionId\`), INDEX \`IDX_25d77dfa246b93672c317e26ad\` (\`startedAt\`), INDEX \`IDX_e759ab5fcf57350da51fcf56bc\` (\`stoppedAt\`), PRIMARY KEY (\`instanceId\`)) ENGINE=InnoDB`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding indexes: We have the convention to give them human readable names, e.g. one on attributionId
would be ind_attributionId
, one on attributionId
and creationTime
ind_attributionId_creationTime
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added names to the indexes and regenerated the migration.
Rename the misnamed primary key `workspaceId` -> `instanceId`. Usage based billing is unreleased so just drop the table and recreate it - no data to migrate. Also add index names.
00c6e66
to
c90db68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/werft run with-clean-slate-deployment=true 👍 started the job as gitpod-build-af-rename-misnamed-column.6 |
/unhold |
Description
Change the name of the
workspaceId
column toinstanceId
in thed_b_workspace_instance_usage
table as that's what it stores.As there is no production data in this table the migration is simply to drop the table and recreate it.
/hold because this is based on #11343.
Related Issue(s)
Part of #10323
How to test
Connecting to the database in the preview env for this PR shows the table with the correct column name.
Release Notes
Documentation
Werft options: