ddl-manager
Version:
store postgres procedures and triggers in files
34 lines • 1.13 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Index = void 0;
const Comment_1 = require("./Comment");
const constants_1 = require("../postgres/constants");
class Index {
constructor(params) {
this.name = params.name.slice(0, constants_1.MAX_NAME_LENGTH);
this.table = params.table;
this.index = params.index;
this.columns = params.columns;
this.comment = params.comment || Comment_1.Comment.frozen("index");
}
equal(otherIndex) {
return (this.name === otherIndex.name &&
this.index === otherIndex.index &&
this.table.equal(otherIndex.table) &&
this.comment.equal(otherIndex.comment) &&
this.columns.toString() == otherIndex.columns.toString());
}
getSignature() {
return this.table.schema + "." + this.name;
}
toSQL() {
return `
create index ${this.name}
on ${this.table}
using ${this.index}
( ${this.columns.join(", ")} )
`;
}
}
exports.Index = Index;
//# sourceMappingURL=Index.js.map