Add command to tag workspace as suspended or as deleted (#9610)

In this PR:
- remove old versions upgrade commands
- add a 0.40 upgrade command to loop over all INACTIVE workspaces and
either: update to SUSPENDED (if workspaceSchema exists), update them to
SUSPENDED + deletedAt (if workspaceSchema does not exist anymore)

Note: why updating the deleted one to SUSPENDED? Because I plan to
remove INACTIVE case in the enum in 0.41

Tests made on production like database:
- dry-mode
- singleWorkspaceId
- 3 cases : suspended, deleted+suspended, deleted+suspended+delete all
data
This commit is contained in:
Charles Bochet
2025-01-14 18:23:42 +01:00
committed by GitHub
parent 87be542185
commit 42ddc09f74
26 changed files with 290 additions and 2087 deletions

View File

@ -4,6 +4,7 @@ import { IDField } from '@ptc-org/nestjs-query-graphql';
import {
Column,
CreateDateColumn,
DeleteDateColumn,
Entity,
Index,
OneToMany,
@ -77,7 +78,7 @@ export class User {
updatedAt: Date;
@Field({ nullable: true })
@Column({ nullable: true, type: 'timestamptz' })
@DeleteDateColumn({ type: 'timestamptz' })
deletedAt: Date;
@OneToMany(() => AppToken, (appToken) => appToken.user, {

View File

@ -4,6 +4,7 @@ import { IDField, UnPagedRelation } from '@ptc-org/nestjs-query-graphql';
import {
Column,
CreateDateColumn,
DeleteDateColumn,
Entity,
OneToMany,
PrimaryGeneratedColumn,
@ -67,7 +68,7 @@ export class Workspace {
inviteHash?: string;
@Field({ nullable: true })
@Column({ nullable: true, type: 'timestamptz' })
@DeleteDateColumn({ type: 'timestamptz' })
deletedAt?: Date;
@Field()