UNPKG

database-builder

Version:

Library to assist in creating and maintaining SQL commands.

48 lines (47 loc) 2.12 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.DropBuilder = void 0; var ddl_base_builder_1 = require("../ddl-base-builder"); var errors_1 = require("../../core/errors"); var utils_1 = require("../../core/utils"); var DropBuilder = /** @class */ (function (_super) { __extends(DropBuilder, _super); function DropBuilder(typeT, _mapperTable) { var _this = _super.call(this, _mapperTable.tableName) || this; _this._mapperTable = _mapperTable; if (utils_1.Utils.isNull(_mapperTable)) { throw new errors_1.DatabaseBuilderError("Mapper not found for '".concat(_this._tablename, "'")); } return _this; } DropBuilder.prototype.resolveDependency = function (dependency) { var create = new DropBuilder(void 0, dependency); return create.build(); }; DropBuilder.prototype.dependencies = function () { return this._mapperTable.dependencies; }; DropBuilder.prototype.buildBase = function () { return "DROP TABLE IF EXISTS ".concat(this._tablename); }; DropBuilder.prototype.setDefaultColumns = function () { // não tem colunas no comando drop }; return DropBuilder; }(ddl_base_builder_1.DdlBaseBuilder)); exports.DropBuilder = DropBuilder;