mirror of
https://github.com/twentyhq/twenty.git
synced 2025-01-03 09:42:01 +03:00
add migration
This commit is contained in:
parent
3fa8df1fc5
commit
1256151647
@ -27,6 +27,7 @@ export class GenerateDefaultSubdomainCommand extends ActiveWorkspacesCommandRunn
|
||||
private generatePayloadForQuery({
|
||||
id,
|
||||
subdomain,
|
||||
// @ts-expect-error - this property doesn't exist anymore
|
||||
domainName,
|
||||
displayName,
|
||||
}: Workspace) {
|
||||
|
@ -20,7 +20,6 @@ export const seedWorkspaces = async (
|
||||
Workspace,
|
||||
| 'id'
|
||||
| 'displayName'
|
||||
| 'domainName'
|
||||
| 'inviteHash'
|
||||
| 'logo'
|
||||
| 'subdomain'
|
||||
@ -30,7 +29,6 @@ export const seedWorkspaces = async (
|
||||
[SEED_APPLE_WORKSPACE_ID]: {
|
||||
id: workspaceId,
|
||||
displayName: 'Apple',
|
||||
domainName: 'apple.dev',
|
||||
subdomain: 'apple',
|
||||
inviteHash: 'apple.dev-invite-hash',
|
||||
logo: 'https://twentyhq.github.io/placeholder-images/workspaces/apple-logo.png',
|
||||
@ -39,7 +37,6 @@ export const seedWorkspaces = async (
|
||||
[SEED_ACME_WORKSPACE_ID]: {
|
||||
id: workspaceId,
|
||||
displayName: 'Acme',
|
||||
domainName: 'acme.dev',
|
||||
subdomain: 'acme',
|
||||
inviteHash: 'acme.dev-invite-hash',
|
||||
logo: 'https://logos-world.net/wp-content/uploads/2022/05/Acme-Logo-700x394.png',
|
||||
|
@ -0,0 +1,24 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddHostnameToWorkspace1734538670589 implements MigrationInterface {
|
||||
name = 'AddHostnameToWorkspace1734538670589';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."workspace" RENAME COLUMN "domainName" TO "hostname"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."workspace" ADD CONSTRAINT "UQ_e6fa363bdaf45cbf8ce97bcebf0" UNIQUE ("hostname")`,
|
||||
);
|
||||
await queryRunner.query(`UPDATE "core"."workspace" SET "hostname" = NULL`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."workspace" DROP CONSTRAINT "UQ_e6fa363bdaf45cbf8ce97bcebf0"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "core"."workspace" RENAME COLUMN "hostname" TO "domainName"`,
|
||||
);
|
||||
}
|
||||
}
|
@ -314,7 +314,6 @@ export class SignInUpService {
|
||||
const workspaceToCreate = this.workspaceRepository.create({
|
||||
subdomain: await this.domainManagerService.generateSubdomain(),
|
||||
displayName: '',
|
||||
domainName: '',
|
||||
inviteHash: v4(),
|
||||
activationStatus: WorkspaceActivationStatus.PENDING_CREATION,
|
||||
});
|
||||
|
@ -51,11 +51,6 @@ export class Workspace {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
// @deprecated. Use hostname field
|
||||
// @Field({ nullable: true })
|
||||
// @Column({ nullable: true })
|
||||
// domainName?: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Column({ nullable: true })
|
||||
displayName?: string;
|
||||
@ -148,8 +143,8 @@ export class Workspace {
|
||||
@Column()
|
||||
subdomain: string;
|
||||
|
||||
@Field()
|
||||
@Column({ unique: true })
|
||||
@Field({ nullable: true })
|
||||
@Column({ unique: true, nullable: true })
|
||||
hostname: string;
|
||||
|
||||
@Field()
|
||||
|
Loading…
Reference in New Issue
Block a user