@triproject/nestjs-core 1.0.48 → 1.0.49
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.
|
@@ -31,6 +31,7 @@ export declare const relationCols: (...args: string[]) => {
|
|
|
31
31
|
export declare const addIndexes: (params: Index) => Promise<void>;
|
|
32
32
|
export declare const deleteIndexes: (params: Index) => Promise<void>;
|
|
33
33
|
export declare const addUniqueIndexes: (params: Index) => Promise<void>;
|
|
34
|
+
export declare const addConstraint: (params: Omit<Index, "options">) => Promise<void>;
|
|
34
35
|
export declare const deleteUniqueIndexes: (params: Index) => Promise<void>;
|
|
35
36
|
export declare const migrationConfig: (migrationTableName: string) => Promise<{
|
|
36
37
|
development: {
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: !0
|
|
4
4
|
});
|
|
5
5
|
var target = exports, all = {
|
|
6
|
+
get addConstraint () {
|
|
7
|
+
return addConstraint;
|
|
8
|
+
},
|
|
6
9
|
get addIndexes () {
|
|
7
10
|
return addIndexes;
|
|
8
11
|
},
|
|
@@ -76,6 +79,13 @@ let _helpers = require("@triproject/helpers"), _sequelize = require("sequelize")
|
|
|
76
79
|
name: index(tableName, columns),
|
|
77
80
|
...options
|
|
78
81
|
});
|
|
82
|
+
}, addConstraint = async (params)=>{
|
|
83
|
+
let { tableName, columns, queryInterface } = params;
|
|
84
|
+
queryInterface.addConstraint(tableName, {
|
|
85
|
+
fields: columns,
|
|
86
|
+
type: 'unique',
|
|
87
|
+
name: index(tableName, columns)
|
|
88
|
+
});
|
|
79
89
|
}, deleteUniqueIndexes = async (params)=>{
|
|
80
90
|
let { tableName, columns, queryInterface } = params;
|
|
81
91
|
await queryInterface.removeIndex(tableName, index(tableName, columns));
|