/
1699491705906-AddSmtpAndPrivacyUrlToPlatform.ts
101 lines (95 loc) · 3.18 KB
/
1699491705906-AddSmtpAndPrivacyUrlToPlatform.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { MigrationInterface, QueryRunner } from 'typeorm'
import { isNotOneOfTheseEditions } from '../../database-common'
import { ApEdition } from '@activepieces/shared'
export class AddSmtpAndPrivacyUrlToPlatform1699491705906
implements MigrationInterface {
name = 'AddSmtpAndPrivacyUrlToPlatform1699491705906'
public async up(queryRunner: QueryRunner): Promise<void> {
if (isNotOneOfTheseEditions([ApEdition.CLOUD, ApEdition.ENTERPRISE])) {
return
}
await queryRunner.query(`
ALTER TABLE "platform"
ADD "smtpHost" character varying
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "smtpPort" integer
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "smtpUser" character varying
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "smtpPassword" character varying
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "smtpSenderEmail" character varying
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "smtpUseSSL" boolean
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "privacyPolicyUrl" character varying
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "termsOfServiceUrl" character varying
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "showPoweredBy" boolean
`)
await queryRunner.query(`
UPDATE "platform"
SET "showPoweredBy" = false
`)
await queryRunner.query(`
ALTER TABLE "platform"
ALTER COLUMN "showPoweredBy" SET NOT NULL
`)
await queryRunner.query(`
ALTER TABLE "platform"
ADD "cloudAuthEnabled" boolean NOT NULL DEFAULT true
`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
if (isNotOneOfTheseEditions([ApEdition.CLOUD, ApEdition.ENTERPRISE])) {
return
}
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "cloudAuthEnabled"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "showPoweredBy"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "termsOfServiceUrl"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "privacyPolicyUrl"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "smtpUseSSL"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "smtpSenderEmail"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "smtpPassword"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "smtpUser"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "smtpPort"
`)
await queryRunner.query(`
ALTER TABLE "platform" DROP COLUMN "smtpHost"
`)
}
}