UNPKG

1.36 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3/**
4 * Check metadata contains all information about table's check constraints.
5 */
6var CheckMetadata = /** @class */ (function () {
7 // ---------------------------------------------------------------------
8 // Constructor
9 // ---------------------------------------------------------------------
10 function CheckMetadata(options) {
11 this.entityMetadata = options.entityMetadata;
12 if (options.args) {
13 this.target = options.args.target;
14 this.expression = options.args.expression;
15 this.givenName = options.args.name;
16 }
17 }
18 // ---------------------------------------------------------------------
19 // Public Build Methods
20 // ---------------------------------------------------------------------
21 /**
22 * Builds some depend check constraint properties.
23 * Must be called after all entity metadata's properties map, columns and relations are built.
24 */
25 CheckMetadata.prototype.build = function (namingStrategy) {
26 this.name = this.givenName ? this.givenName : namingStrategy.checkConstraintName(this.entityMetadata.tablePath, this.expression);
27 return this;
28 };
29 return CheckMetadata;
30}());
31exports.CheckMetadata = CheckMetadata;
32
33//# sourceMappingURL=CheckMetadata.js.map