@reachu/database 1.0.70 → 1.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entity/ExternalRequest.d.ts +3 -0
- package/dist/entity/ExternalRequest.js +10 -0
- package/dist/entity/ExternalRequest.js.map +1 -1
- package/dist/migrations/1684452127341-externalRequest_v1.d.ts +6 -0
- package/dist/migrations/1684452127341-externalRequest_v1.js +33 -0
- package/dist/migrations/1684452127341-externalRequest_v1.js.map +1 -0
- package/dist/migrations/1684452476996-externalRequest_v2.d.ts +6 -0
- package/dist/migrations/1684452476996-externalRequest_v2.js +33 -0
- package/dist/migrations/1684452476996-externalRequest_v2.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +28 -2
- package/package.json +3 -3
- package/src/entity/ExternalRequest.ts +11 -0
- package/src/migrations/1684452127341-externalRequest_v1.ts +18 -0
- package/src/migrations/1684452476996-externalRequest_v2.ts +18 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import AuditedModel from './AuditedModel';
|
|
2
|
+
import Plan from './modules/subscriptions/Plan';
|
|
2
3
|
import User from './User';
|
|
3
4
|
export default class ExternalRequest extends AuditedModel {
|
|
4
5
|
id: number;
|
|
5
6
|
sender: User;
|
|
7
|
+
plan: Plan;
|
|
6
8
|
receiverEmail: string;
|
|
9
|
+
collection: number;
|
|
7
10
|
url: string;
|
|
8
11
|
state: number;
|
|
9
12
|
}
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const typeorm_1 = require("typeorm");
|
|
16
16
|
const AuditedModel_1 = __importDefault(require("./AuditedModel"));
|
|
17
|
+
const Plan_1 = __importDefault(require("./modules/subscriptions/Plan"));
|
|
17
18
|
const User_1 = __importDefault(require("./User"));
|
|
18
19
|
let ExternalRequest = class ExternalRequest extends AuditedModel_1.default {
|
|
19
20
|
};
|
|
@@ -26,10 +27,19 @@ __decorate([
|
|
|
26
27
|
typeorm_1.JoinColumn(),
|
|
27
28
|
__metadata("design:type", User_1.default)
|
|
28
29
|
], ExternalRequest.prototype, "sender", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
typeorm_1.ManyToOne(() => Plan_1.default, { eager: true, onDelete: 'CASCADE' }),
|
|
32
|
+
typeorm_1.JoinColumn(),
|
|
33
|
+
__metadata("design:type", Plan_1.default)
|
|
34
|
+
], ExternalRequest.prototype, "plan", void 0);
|
|
29
35
|
__decorate([
|
|
30
36
|
typeorm_1.Column('varchar'),
|
|
31
37
|
__metadata("design:type", String)
|
|
32
38
|
], ExternalRequest.prototype, "receiverEmail", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
typeorm_1.Column('integer', { nullable: true, default: 0 }),
|
|
41
|
+
__metadata("design:type", Number)
|
|
42
|
+
], ExternalRequest.prototype, "collection", void 0);
|
|
33
43
|
__decorate([
|
|
34
44
|
typeorm_1.Column('varchar'),
|
|
35
45
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalRequest.js","sourceRoot":"","sources":["../../src/entity/ExternalRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAwF;AACxF,kEAA0C;AAC1C,kDAA0B;AAG1B,IAAqB,eAAe,GAApC,MAAqB,eAAgB,SAAQ,sBAAY;
|
|
1
|
+
{"version":3,"file":"ExternalRequest.js","sourceRoot":"","sources":["../../src/entity/ExternalRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAwF;AACxF,kEAA0C;AAC1C,wEAA+C;AAC/C,kDAA0B;AAG1B,IAAqB,eAAe,GAApC,MAAqB,eAAgB,SAAQ,sBAAY;CA0BxD,CAAA;AAxBC;IADC,gCAAsB,EAAE;;2CACd;AAIX;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC3D,oBAAU,EAAE;8BACL,cAAI;+CAAC;AAIb;IAFC,mBAAS,CAAC,GAAG,EAAE,CAAC,cAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC3D,oBAAU,EAAE;8BACP,cAAI;6CAAC;AAGX;IADC,gBAAM,CAAC,SAAS,CAAC;;sDACI;AAGtB;IADC,gBAAM,CAAC,SAAS,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAC,CAAC;;mDAC5B;AAGnB;IADC,gBAAM,CAAC,SAAS,CAAC;;4CACN;AAMZ;IADC,gBAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8CACpC;AAzBK,eAAe;IADnC,gBAAM,EAAE;GACY,eAAe,CA0BnC;kBA1BoB,eAAe"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.externalRequestV11684452127341 = void 0;
|
|
13
|
+
class externalRequestV11684452127341 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'externalRequestV11684452127341';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` ADD \`collection\` int NULL DEFAULT '0'`);
|
|
20
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` ADD \`plan_id\` int NULL`);
|
|
21
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` ADD CONSTRAINT \`FK_6bba3dfa40a288826cda4ddacc5\` FOREIGN KEY (\`plan_id\`) REFERENCES \`plan\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
down(queryRunner) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` DROP FOREIGN KEY \`FK_6bba3dfa40a288826cda4ddacc5\``);
|
|
27
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` DROP COLUMN \`plan_id\``);
|
|
28
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` DROP COLUMN \`collection\``);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.externalRequestV11684452127341 = externalRequestV11684452127341;
|
|
33
|
+
//# sourceMappingURL=1684452127341-externalRequest_v1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1684452127341-externalRequest_v1.js","sourceRoot":"","sources":["../../src/migrations/1684452127341-externalRequest_v1.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,8BAA8B;IAA3C;QACI,SAAI,GAAG,gCAAgC,CAAA;IAc3C,CAAC;IAZgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,0EAA0E,CAAC,CAAC;YACpG,MAAM,WAAW,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;YACrF,MAAM,WAAW,CAAC,KAAK,CAAC,gLAAgL,CAAC,CAAC;QAC9M,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;YAChH,MAAM,WAAW,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;YACpF,MAAM,WAAW,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;QAC3F,CAAC;KAAA;CAEJ;AAfD,wEAeC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.externalRequestV21684452476996 = void 0;
|
|
13
|
+
class externalRequestV21684452476996 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'externalRequestV21684452476996';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`CREATE TABLE \`external_request\` (\`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`id\` int NOT NULL AUTO_INCREMENT, \`receiver_email\` varchar(255) NOT NULL, \`collection\` int NULL DEFAULT '0', \`url\` varchar(255) NOT NULL, \`state\` int NULL DEFAULT '0', \`sender_id\` int NULL, \`plan_id\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
20
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` ADD CONSTRAINT \`FK_c7fdd1f3e8a0f9deed266cf6d47\` FOREIGN KEY (\`sender_id\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
21
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` ADD CONSTRAINT \`FK_6bba3dfa40a288826cda4ddacc5\` FOREIGN KEY (\`plan_id\`) REFERENCES \`plan\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
down(queryRunner) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` DROP FOREIGN KEY \`FK_6bba3dfa40a288826cda4ddacc5\``);
|
|
27
|
+
yield queryRunner.query(`ALTER TABLE \`external_request\` DROP FOREIGN KEY \`FK_c7fdd1f3e8a0f9deed266cf6d47\``);
|
|
28
|
+
yield queryRunner.query(`DROP TABLE \`external_request\``);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.externalRequestV21684452476996 = externalRequestV21684452476996;
|
|
33
|
+
//# sourceMappingURL=1684452476996-externalRequest_v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1684452476996-externalRequest_v2.js","sourceRoot":"","sources":["../../src/migrations/1684452476996-externalRequest_v2.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,8BAA8B;IAA3C;QACI,SAAI,GAAG,gCAAgC,CAAA;IAc3C,CAAC;IAZgB,EAAE,CAAC,WAAwB;;YACpC,MAAM,WAAW,CAAC,KAAK,CAAC,2cAA2c,CAAC,CAAC;YACre,MAAM,WAAW,CAAC,KAAK,CAAC,kLAAkL,CAAC,CAAC;YAC5M,MAAM,WAAW,CAAC,KAAK,CAAC,gLAAgL,CAAC,CAAC;QAC9M,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;YAChH,MAAM,WAAW,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;YAChH,MAAM,WAAW,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC/D,CAAC;KAAA;CAEJ;AAfD,wEAeC"}
|
|
@@ -2617,8 +2617,8 @@
|
|
|
2617
2617
|
"affectsGlobalScope": false
|
|
2618
2618
|
},
|
|
2619
2619
|
"../src/entity/externalrequest.ts": {
|
|
2620
|
-
"version": "
|
|
2621
|
-
"signature": "
|
|
2620
|
+
"version": "0b9493f093b9f9c0f3461e20fb18855d6b2e19bfc174fd35738b3b3a9b97a821",
|
|
2621
|
+
"signature": "4ff799881b47b74a2d88b12c67727dedd7e5f1a33c1cdf57237b64c588972da8",
|
|
2622
2622
|
"affectsGlobalScope": false
|
|
2623
2623
|
},
|
|
2624
2624
|
"../src/entity/wallet.ts": {
|
|
@@ -3246,6 +3246,16 @@
|
|
|
3246
3246
|
"signature": "efa1b2a3bc304f80a628444319086645d910534bed8b925bb317ebfeb4d0c479",
|
|
3247
3247
|
"affectsGlobalScope": false
|
|
3248
3248
|
},
|
|
3249
|
+
"../src/migrations/1684452127341-externalrequest_v1.ts": {
|
|
3250
|
+
"version": "e39b4bc92c2b6e579224b6df69ae9b5165e3c470fe4298ca569419889aef2a72",
|
|
3251
|
+
"signature": "55d83a9fd40ea572a7e5b735749b66a53d6743e310b062f95a0f428d9992e9fd",
|
|
3252
|
+
"affectsGlobalScope": false
|
|
3253
|
+
},
|
|
3254
|
+
"../src/migrations/1684452476996-externalrequest_v2.ts": {
|
|
3255
|
+
"version": "a2d1a0e14d2ae1974eff46e51e07921848a7de839ab708d537be58ed72da89d6",
|
|
3256
|
+
"signature": "c4e30a983142c885fadda46bd7ed591a288e328626bf9b271e639bd9413c32bb",
|
|
3257
|
+
"affectsGlobalScope": false
|
|
3258
|
+
},
|
|
3249
3259
|
"../src/migrations/execute/index.ts": {
|
|
3250
3260
|
"version": "8b5bf13d095aeb57afd593adf3d799681176a13c327e2f77e0028e178c4ee3b9",
|
|
3251
3261
|
"signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
|
|
@@ -5338,6 +5348,7 @@
|
|
|
5338
5348
|
"../src/entity/externalrequest.ts": [
|
|
5339
5349
|
"../node_modules/typeorm/index.d.ts",
|
|
5340
5350
|
"../src/entity/auditedmodel.ts",
|
|
5351
|
+
"../src/entity/modules/subscriptions/plan.ts",
|
|
5341
5352
|
"../src/entity/user.ts"
|
|
5342
5353
|
],
|
|
5343
5354
|
"../src/entity/flatrate.ts": [
|
|
@@ -6056,6 +6067,12 @@
|
|
|
6056
6067
|
"../src/migrations/1684451330738-externalrequest.ts": [
|
|
6057
6068
|
"../node_modules/typeorm/index.d.ts"
|
|
6058
6069
|
],
|
|
6070
|
+
"../src/migrations/1684452127341-externalrequest_v1.ts": [
|
|
6071
|
+
"../node_modules/typeorm/index.d.ts"
|
|
6072
|
+
],
|
|
6073
|
+
"../src/migrations/1684452476996-externalrequest_v2.ts": [
|
|
6074
|
+
"../node_modules/typeorm/index.d.ts"
|
|
6075
|
+
],
|
|
6059
6076
|
"../src/migrations/execute/index.ts": [
|
|
6060
6077
|
"../src/config/connect.ts"
|
|
6061
6078
|
],
|
|
@@ -8102,6 +8119,7 @@
|
|
|
8102
8119
|
],
|
|
8103
8120
|
"../src/entity/externalrequest.ts": [
|
|
8104
8121
|
"../src/entity/auditedmodel.ts",
|
|
8122
|
+
"../src/entity/modules/subscriptions/plan.ts",
|
|
8105
8123
|
"../src/entity/user.ts"
|
|
8106
8124
|
],
|
|
8107
8125
|
"../src/entity/flatrate.ts": [
|
|
@@ -8721,6 +8739,12 @@
|
|
|
8721
8739
|
"../src/migrations/1684451330738-externalrequest.ts": [
|
|
8722
8740
|
"../node_modules/typeorm/index.d.ts"
|
|
8723
8741
|
],
|
|
8742
|
+
"../src/migrations/1684452127341-externalrequest_v1.ts": [
|
|
8743
|
+
"../node_modules/typeorm/index.d.ts"
|
|
8744
|
+
],
|
|
8745
|
+
"../src/migrations/1684452476996-externalrequest_v2.ts": [
|
|
8746
|
+
"../node_modules/typeorm/index.d.ts"
|
|
8747
|
+
],
|
|
8724
8748
|
"../src/migrations/index.ts": [
|
|
8725
8749
|
"../src/migrations/1628474597284-initialschema.ts",
|
|
8726
8750
|
"../src/migrations/1630077596132-removemangopay.ts",
|
|
@@ -9518,6 +9542,8 @@
|
|
|
9518
9542
|
"../src/migrations/1683908691683-connections-update.ts",
|
|
9519
9543
|
"../src/migrations/1684176902363-connections-update-2.ts",
|
|
9520
9544
|
"../src/migrations/1684451330738-externalrequest.ts",
|
|
9545
|
+
"../src/migrations/1684452127341-externalrequest_v1.ts",
|
|
9546
|
+
"../src/migrations/1684452476996-externalrequest_v2.ts",
|
|
9521
9547
|
"../src/migrations/execute/index.ts",
|
|
9522
9548
|
"../src/migrations/index.ts",
|
|
9523
9549
|
"../src/repositories/index.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reachu/database",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.72",
|
|
4
4
|
"description": "reachu-database",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"author": "reachu",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@reachu/logger": "1.0.
|
|
25
|
-
"@reachu/utils": "1.0.
|
|
24
|
+
"@reachu/logger": "1.0.72",
|
|
25
|
+
"@reachu/utils": "1.0.72",
|
|
26
26
|
"dotenv": "8.0.0",
|
|
27
27
|
"express": "4.17.1",
|
|
28
28
|
"mysql2": "1.5.2",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Entity, PrimaryGeneratedColumn, Column, JoinColumn, ManyToOne } from 'typeorm';
|
|
2
2
|
import AuditedModel from './AuditedModel';
|
|
3
|
+
import Plan from './modules/subscriptions/Plan'
|
|
3
4
|
import User from './User';
|
|
4
5
|
|
|
5
6
|
@Entity()
|
|
@@ -11,12 +12,22 @@ export default class ExternalRequest extends AuditedModel {
|
|
|
11
12
|
@JoinColumn()
|
|
12
13
|
sender: User;
|
|
13
14
|
|
|
15
|
+
@ManyToOne(() => Plan, { eager: true, onDelete: 'CASCADE' })
|
|
16
|
+
@JoinColumn()
|
|
17
|
+
plan: Plan;
|
|
18
|
+
|
|
14
19
|
@Column('varchar')
|
|
15
20
|
receiverEmail: string;
|
|
16
21
|
|
|
22
|
+
@Column('integer',{nullable: true, default: 0})
|
|
23
|
+
collection: number;
|
|
24
|
+
|
|
17
25
|
@Column('varchar')
|
|
18
26
|
url: string;
|
|
19
27
|
|
|
28
|
+
// 0 pending
|
|
29
|
+
// 1 accepted
|
|
30
|
+
// 2 denied
|
|
20
31
|
@Column('integer', { nullable: true, default: 0 })
|
|
21
32
|
state: number;
|
|
22
33
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class externalRequestV11684452127341 implements MigrationInterface {
|
|
4
|
+
name = 'externalRequestV11684452127341'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` ADD \`collection\` int NULL DEFAULT '0'`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` ADD \`plan_id\` int NULL`);
|
|
9
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` ADD CONSTRAINT \`FK_6bba3dfa40a288826cda4ddacc5\` FOREIGN KEY (\`plan_id\`) REFERENCES \`plan\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` DROP FOREIGN KEY \`FK_6bba3dfa40a288826cda4ddacc5\``);
|
|
14
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` DROP COLUMN \`plan_id\``);
|
|
15
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` DROP COLUMN \`collection\``);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {MigrationInterface, QueryRunner} from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class externalRequestV21684452476996 implements MigrationInterface {
|
|
4
|
+
name = 'externalRequestV21684452476996'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE \`external_request\` (\`created_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), \`updated_at\` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`id\` int NOT NULL AUTO_INCREMENT, \`receiver_email\` varchar(255) NOT NULL, \`collection\` int NULL DEFAULT '0', \`url\` varchar(255) NOT NULL, \`state\` int NULL DEFAULT '0', \`sender_id\` int NULL, \`plan_id\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` ADD CONSTRAINT \`FK_c7fdd1f3e8a0f9deed266cf6d47\` FOREIGN KEY (\`sender_id\`) REFERENCES \`user\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
9
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` ADD CONSTRAINT \`FK_6bba3dfa40a288826cda4ddacc5\` FOREIGN KEY (\`plan_id\`) REFERENCES \`plan\`(\`id\`) ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
13
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` DROP FOREIGN KEY \`FK_6bba3dfa40a288826cda4ddacc5\``);
|
|
14
|
+
await queryRunner.query(`ALTER TABLE \`external_request\` DROP FOREIGN KEY \`FK_c7fdd1f3e8a0f9deed266cf6d47\``);
|
|
15
|
+
await queryRunner.query(`DROP TABLE \`external_request\``);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|