"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
exports.__esModule = true;
exports.getDatabaseResources = void 0;
var postgres_1 = require("./postgres");
var redshift_1 = require("./redshift");
var sqlite3_1 = require("./sqlite3");
var mysql_1 = require("./mysql");
var mssql_1 = require("./mssql");
var oracle_1 = require("./oracle");
exports.getDatabaseResources = function (_a) {
    var db = _a.db;
    var migrationTable = db.client.config.migrations.tableName || "";
    var loadDialectConfig = function (fn) { return (__assign(__assign({}, fn({ migrationTable: migrationTable })), { dbGeometryColumns: undefined })); };
    // keys in this object map to the knex client value
    var supportedClients = {
        pg: postgres_1.dialect({ migrationTable: migrationTable }),
        redshift: loadDialectConfig(redshift_1.dialect),
        sqlite3: loadDialectConfig(sqlite3_1.dialect),
        mysql: loadDialectConfig(mysql_1.dialect),
        mysql2: loadDialectConfig(mysql_1.dialect),
        mssql: loadDialectConfig(mssql_1.dialect),
        oracledb: loadDialectConfig(oracle_1.dialect)
    };
    if (supportedClients.hasOwnProperty(db.client.config.client)) {
        return supportedClients[db.client.config.client];
    }
    throw new Error("unsupported db engine: postgres, mysql, mssql, redshift, sqlite3, oracledb only");
};
//# sourceMappingURL=index.js.map