drizzle-kit 0.12.12 → 0.12.14
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.
- package/index.js +503 -2343
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
8
11
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
12
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
13
|
};
|
|
@@ -7339,1916 +7342,291 @@ var require_node2 = __commonJS({
|
|
|
7339
7342
|
}
|
|
7340
7343
|
});
|
|
7341
7344
|
|
|
7342
|
-
//
|
|
7343
|
-
var
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
var CheckBuilder = class {
|
|
7349
|
-
constructor(name, value) {
|
|
7350
|
-
this.name = name;
|
|
7351
|
-
this.value = value;
|
|
7352
|
-
}
|
|
7353
|
-
build(table4) {
|
|
7354
|
-
return new Check(table4, this);
|
|
7355
|
-
}
|
|
7356
|
-
};
|
|
7357
|
-
exports.CheckBuilder = CheckBuilder;
|
|
7358
|
-
var Check = class {
|
|
7359
|
-
constructor(table4, builder) {
|
|
7360
|
-
this.table = table4;
|
|
7361
|
-
this.name = builder.name;
|
|
7362
|
-
this.value = builder.value;
|
|
7363
|
-
}
|
|
7364
|
-
};
|
|
7365
|
-
exports.Check = Check;
|
|
7366
|
-
function check(name, value) {
|
|
7367
|
-
return new CheckBuilder(name, value);
|
|
7368
|
-
}
|
|
7369
|
-
exports.check = check;
|
|
7370
|
-
}
|
|
7371
|
-
});
|
|
7372
|
-
|
|
7373
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/foreign-keys.js
|
|
7374
|
-
var require_foreign_keys = __commonJS({
|
|
7375
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/foreign-keys.js"(exports) {
|
|
7376
|
-
"use strict";
|
|
7377
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7378
|
-
exports.foreignKey = exports.ForeignKey = exports.ForeignKeyBuilder = void 0;
|
|
7379
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
7380
|
-
var ForeignKeyBuilder = class {
|
|
7381
|
-
constructor(config, actions) {
|
|
7382
|
-
this.reference = () => {
|
|
7383
|
-
const { columns, foreignColumns } = config();
|
|
7384
|
-
return { columns, foreignTable: foreignColumns[0].table, foreignColumns };
|
|
7385
|
-
};
|
|
7386
|
-
if (actions) {
|
|
7387
|
-
this._onUpdate = actions.onUpdate;
|
|
7388
|
-
this._onDelete = actions.onDelete;
|
|
7389
|
-
}
|
|
7390
|
-
}
|
|
7391
|
-
onUpdate(action) {
|
|
7392
|
-
this._onUpdate = action;
|
|
7393
|
-
return this;
|
|
7394
|
-
}
|
|
7395
|
-
onDelete(action) {
|
|
7396
|
-
this._onDelete = action;
|
|
7397
|
-
return this;
|
|
7398
|
-
}
|
|
7399
|
-
build(table4) {
|
|
7400
|
-
return new ForeignKey2(table4, this);
|
|
7401
|
-
}
|
|
7402
|
-
};
|
|
7403
|
-
exports.ForeignKeyBuilder = ForeignKeyBuilder;
|
|
7404
|
-
var ForeignKey2 = class {
|
|
7405
|
-
constructor(table4, builder) {
|
|
7406
|
-
this.table = table4;
|
|
7407
|
-
this.reference = builder.reference;
|
|
7408
|
-
this.onUpdate = builder._onUpdate;
|
|
7409
|
-
this.onDelete = builder._onDelete;
|
|
7410
|
-
}
|
|
7411
|
-
getName() {
|
|
7412
|
-
const { columns, foreignColumns } = this.reference();
|
|
7413
|
-
const columnNames = columns.map((column4) => column4.name);
|
|
7414
|
-
const foreignColumnNames = foreignColumns.map((column4) => column4.name);
|
|
7415
|
-
const chunks = [
|
|
7416
|
-
this.table[utils_1.tableName],
|
|
7417
|
-
...columnNames,
|
|
7418
|
-
foreignColumns[0].table[utils_1.tableName],
|
|
7419
|
-
...foreignColumnNames
|
|
7420
|
-
];
|
|
7421
|
-
return `${chunks.join("_")}_fk`;
|
|
7422
|
-
}
|
|
7423
|
-
};
|
|
7424
|
-
exports.ForeignKey = ForeignKey2;
|
|
7425
|
-
function _foreignKey(config) {
|
|
7426
|
-
function mappedConfig() {
|
|
7427
|
-
const { columns, foreignColumns } = config();
|
|
7428
|
-
return {
|
|
7429
|
-
columns: Array.isArray(columns) ? columns : [columns],
|
|
7430
|
-
foreignColumns: Array.isArray(foreignColumns) ? foreignColumns : [foreignColumns]
|
|
7431
|
-
};
|
|
7432
|
-
}
|
|
7433
|
-
return new ForeignKeyBuilder(mappedConfig);
|
|
7434
|
-
}
|
|
7435
|
-
function foreignKey(config) {
|
|
7436
|
-
return _foreignKey(config);
|
|
7437
|
-
}
|
|
7438
|
-
exports.foreignKey = foreignKey;
|
|
7439
|
-
}
|
|
7345
|
+
// src/serializer/imports.ts
|
|
7346
|
+
var imports_exports = {};
|
|
7347
|
+
__export(imports_exports, {
|
|
7348
|
+
prepareFromImports: () => prepareFromImports,
|
|
7349
|
+
prepareFromMySqlImports: () => prepareFromMySqlImports,
|
|
7350
|
+
prepareFromSqliteImports: () => prepareFromSqliteImports
|
|
7440
7351
|
});
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
return super.notNull();
|
|
7458
|
-
}
|
|
7459
|
-
default(value) {
|
|
7460
|
-
return super.default(value);
|
|
7461
|
-
}
|
|
7462
|
-
primaryKey() {
|
|
7463
|
-
return super.primaryKey();
|
|
7464
|
-
}
|
|
7465
|
-
references(ref, actions = {}) {
|
|
7466
|
-
this.foreignKeyConfigs.push({ ref, actions });
|
|
7467
|
-
return this;
|
|
7468
|
-
}
|
|
7469
|
-
buildForeignKeys(column4, table4) {
|
|
7470
|
-
return this.foreignKeyConfigs.map(({ ref, actions }) => {
|
|
7471
|
-
const builder = new foreign_keys_1.ForeignKeyBuilder(() => {
|
|
7472
|
-
const foreignColumn = ref();
|
|
7473
|
-
return { columns: [column4], foreignColumns: [foreignColumn] };
|
|
7474
|
-
});
|
|
7475
|
-
if (actions.onUpdate) {
|
|
7476
|
-
builder.onUpdate(actions.onUpdate);
|
|
7352
|
+
var import_drizzle_orm_mysql, import_drizzle_orm_pg, import_drizzle_orm_sqlite, prepareFromImports, prepareFromMySqlImports, prepareFromSqliteImports;
|
|
7353
|
+
var init_imports = __esm({
|
|
7354
|
+
"src/serializer/imports.ts"() {
|
|
7355
|
+
import_drizzle_orm_mysql = require("drizzle-orm-mysql");
|
|
7356
|
+
import_drizzle_orm_pg = require("drizzle-orm-pg");
|
|
7357
|
+
import_drizzle_orm_sqlite = require("drizzle-orm-sqlite");
|
|
7358
|
+
prepareFromImports = (imports) => {
|
|
7359
|
+
const tables = [];
|
|
7360
|
+
const enums = [];
|
|
7361
|
+
imports.forEach((it) => {
|
|
7362
|
+
const i0 = require(it);
|
|
7363
|
+
const i0values = Object.values(i0);
|
|
7364
|
+
i0values.forEach((t) => {
|
|
7365
|
+
if ((0, import_drizzle_orm_pg.isPgEnum)(t)) {
|
|
7366
|
+
enums.push(t);
|
|
7367
|
+
return;
|
|
7477
7368
|
}
|
|
7478
|
-
if (
|
|
7479
|
-
|
|
7369
|
+
if (t instanceof import_drizzle_orm_pg.PgTable) {
|
|
7370
|
+
tables.push(
|
|
7371
|
+
t
|
|
7372
|
+
);
|
|
7480
7373
|
}
|
|
7481
|
-
return builder.build(table4);
|
|
7482
7374
|
});
|
|
7483
|
-
}
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
}
|
|
7516
|
-
});
|
|
7517
|
-
|
|
7518
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/bigint.js
|
|
7519
|
-
var require_bigint = __commonJS({
|
|
7520
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/bigint.js"(exports) {
|
|
7521
|
-
"use strict";
|
|
7522
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7523
|
-
exports.bigint = exports.MySqlBigInt64 = exports.MySqlBigInt64Builder = exports.MySqlBigInt53 = exports.MySqlBigInt53Builder = void 0;
|
|
7524
|
-
var common_1 = require_common2();
|
|
7525
|
-
var MySqlBigInt53Builder = class extends common_1.MySqlColumnBuilderWithAutoIncrement {
|
|
7526
|
-
build(table4) {
|
|
7527
|
-
return new MySqlBigInt53(table4, this);
|
|
7528
|
-
}
|
|
7529
|
-
};
|
|
7530
|
-
exports.MySqlBigInt53Builder = MySqlBigInt53Builder;
|
|
7531
|
-
var MySqlBigInt53 = class extends common_1.MySqlColumnWithAutoIncrement {
|
|
7532
|
-
getSQLType() {
|
|
7533
|
-
return "bigint";
|
|
7534
|
-
}
|
|
7535
|
-
mapFromDriverValue(value) {
|
|
7536
|
-
if (typeof value === "number") {
|
|
7537
|
-
return value;
|
|
7538
|
-
}
|
|
7539
|
-
return parseInt(value);
|
|
7540
|
-
}
|
|
7541
|
-
};
|
|
7542
|
-
exports.MySqlBigInt53 = MySqlBigInt53;
|
|
7543
|
-
var MySqlBigInt64Builder = class extends common_1.MySqlColumnBuilder {
|
|
7544
|
-
build(table4) {
|
|
7545
|
-
return new MySqlBigInt64(table4, this);
|
|
7546
|
-
}
|
|
7547
|
-
};
|
|
7548
|
-
exports.MySqlBigInt64Builder = MySqlBigInt64Builder;
|
|
7549
|
-
var MySqlBigInt64 = class extends common_1.MySqlColumn {
|
|
7550
|
-
getSQLType() {
|
|
7551
|
-
return "bigint";
|
|
7552
|
-
}
|
|
7553
|
-
mapFromDriverValue(value) {
|
|
7554
|
-
return BigInt(value);
|
|
7555
|
-
}
|
|
7556
|
-
};
|
|
7557
|
-
exports.MySqlBigInt64 = MySqlBigInt64;
|
|
7558
|
-
function bigint(name, { mode }) {
|
|
7559
|
-
if (mode === "number") {
|
|
7560
|
-
return new MySqlBigInt53Builder(name);
|
|
7561
|
-
}
|
|
7562
|
-
return new MySqlBigInt64Builder(name);
|
|
7563
|
-
}
|
|
7564
|
-
exports.bigint = bigint;
|
|
7565
|
-
}
|
|
7566
|
-
});
|
|
7567
|
-
|
|
7568
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/binary.js
|
|
7569
|
-
var require_binary = __commonJS({
|
|
7570
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/binary.js"(exports) {
|
|
7571
|
-
"use strict";
|
|
7572
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7573
|
-
exports.binary = exports.MySqlBinary = exports.MySqlBinaryBuilder = void 0;
|
|
7574
|
-
var common_1 = require_common2();
|
|
7575
|
-
var MySqlBinaryBuilder = class extends common_1.MySqlColumnBuilder {
|
|
7576
|
-
constructor(name, length) {
|
|
7577
|
-
super(name);
|
|
7578
|
-
this.length = length;
|
|
7579
|
-
}
|
|
7580
|
-
build(table4) {
|
|
7581
|
-
return new MySqlBinary(table4, this);
|
|
7582
|
-
}
|
|
7583
|
-
};
|
|
7584
|
-
exports.MySqlBinaryBuilder = MySqlBinaryBuilder;
|
|
7585
|
-
var MySqlBinary = class extends common_1.MySqlColumn {
|
|
7586
|
-
constructor(table4, builder) {
|
|
7587
|
-
super(table4, builder);
|
|
7588
|
-
this.length = builder.length;
|
|
7589
|
-
}
|
|
7590
|
-
getSQLType() {
|
|
7591
|
-
return typeof this.length !== "undefined" ? `binary(${this.length})` : `binary`;
|
|
7592
|
-
}
|
|
7593
|
-
};
|
|
7594
|
-
exports.MySqlBinary = MySqlBinary;
|
|
7595
|
-
function binary(name, config = {}) {
|
|
7596
|
-
return new MySqlBinaryBuilder(name, config.length);
|
|
7597
|
-
}
|
|
7598
|
-
exports.binary = binary;
|
|
7599
|
-
}
|
|
7600
|
-
});
|
|
7601
|
-
|
|
7602
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/char.js
|
|
7603
|
-
var require_char = __commonJS({
|
|
7604
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/char.js"(exports) {
|
|
7605
|
-
"use strict";
|
|
7606
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7607
|
-
exports.char = exports.MySqlChar = exports.MySqlCharBuilder = void 0;
|
|
7608
|
-
var common_1 = require_common2();
|
|
7609
|
-
var MySqlCharBuilder = class extends common_1.MySqlColumnBuilder {
|
|
7610
|
-
constructor(name, length) {
|
|
7611
|
-
super(name);
|
|
7612
|
-
this.length = length;
|
|
7613
|
-
}
|
|
7614
|
-
build(table4) {
|
|
7615
|
-
return new MySqlChar(table4, this);
|
|
7616
|
-
}
|
|
7617
|
-
};
|
|
7618
|
-
exports.MySqlCharBuilder = MySqlCharBuilder;
|
|
7619
|
-
var MySqlChar = class extends common_1.MySqlColumn {
|
|
7620
|
-
constructor(table4, builder) {
|
|
7621
|
-
super(table4, builder);
|
|
7622
|
-
this.length = builder.length;
|
|
7623
|
-
}
|
|
7624
|
-
getSQLType() {
|
|
7625
|
-
return typeof this.length !== "undefined" ? `char(${this.length})` : `char`;
|
|
7626
|
-
}
|
|
7375
|
+
});
|
|
7376
|
+
return { tables, enums };
|
|
7377
|
+
};
|
|
7378
|
+
prepareFromMySqlImports = (imports) => {
|
|
7379
|
+
const tables = [];
|
|
7380
|
+
const enums = [];
|
|
7381
|
+
imports.forEach((it) => {
|
|
7382
|
+
const i0 = require(it);
|
|
7383
|
+
const i0values = Object.values(i0);
|
|
7384
|
+
i0values.forEach((t) => {
|
|
7385
|
+
if (t instanceof import_drizzle_orm_mysql.MySqlTable) {
|
|
7386
|
+
tables.push(
|
|
7387
|
+
t
|
|
7388
|
+
);
|
|
7389
|
+
}
|
|
7390
|
+
});
|
|
7391
|
+
});
|
|
7392
|
+
return { tables, enums };
|
|
7393
|
+
};
|
|
7394
|
+
prepareFromSqliteImports = (imports) => {
|
|
7395
|
+
const tables = [];
|
|
7396
|
+
const enums = [];
|
|
7397
|
+
imports.forEach((it) => {
|
|
7398
|
+
const i0 = require(it);
|
|
7399
|
+
const i0values = Object.values(i0);
|
|
7400
|
+
i0values.forEach((t) => {
|
|
7401
|
+
if (t instanceof import_drizzle_orm_sqlite.SQLiteTable) {
|
|
7402
|
+
tables.push(t);
|
|
7403
|
+
}
|
|
7404
|
+
});
|
|
7405
|
+
});
|
|
7406
|
+
return { tables, enums };
|
|
7627
7407
|
};
|
|
7628
|
-
exports.MySqlChar = MySqlChar;
|
|
7629
|
-
function char(name, config = {}) {
|
|
7630
|
-
return new MySqlCharBuilder(name, config.length);
|
|
7631
|
-
}
|
|
7632
|
-
exports.char = char;
|
|
7633
7408
|
}
|
|
7634
7409
|
});
|
|
7635
7410
|
|
|
7636
|
-
//
|
|
7637
|
-
var
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7641
|
-
exports.decimal = exports.MySqlDecimal = exports.MySqlDecimalBuilder = void 0;
|
|
7642
|
-
var common_1 = require_common2();
|
|
7643
|
-
var MySqlDecimalBuilder = class extends common_1.MySqlColumnBuilder {
|
|
7644
|
-
constructor(name, precision, scale) {
|
|
7645
|
-
super(name);
|
|
7646
|
-
this.precision = precision;
|
|
7647
|
-
this.scale = scale;
|
|
7648
|
-
}
|
|
7649
|
-
build(table4) {
|
|
7650
|
-
return new MySqlDecimal(table4, this);
|
|
7651
|
-
}
|
|
7652
|
-
};
|
|
7653
|
-
exports.MySqlDecimalBuilder = MySqlDecimalBuilder;
|
|
7654
|
-
var MySqlDecimal = class extends common_1.MySqlColumn {
|
|
7655
|
-
constructor(table4, builder) {
|
|
7656
|
-
super(table4, builder);
|
|
7657
|
-
this.precision = builder.precision;
|
|
7658
|
-
this.scale = builder.scale;
|
|
7659
|
-
}
|
|
7660
|
-
getSQLType() {
|
|
7661
|
-
if (typeof this.precision !== "undefined" && typeof this.scale !== "undefined") {
|
|
7662
|
-
return `decimal(${this.precision}, ${this.scale})`;
|
|
7663
|
-
} else if (typeof this.precision === "undefined") {
|
|
7664
|
-
return "decimal";
|
|
7665
|
-
} else {
|
|
7666
|
-
return `decimal(${this.precision})`;
|
|
7667
|
-
}
|
|
7668
|
-
}
|
|
7669
|
-
};
|
|
7670
|
-
exports.MySqlDecimal = MySqlDecimal;
|
|
7671
|
-
function decimal(name, config = {}) {
|
|
7672
|
-
return new MySqlDecimalBuilder(name, config.precision, config.scale);
|
|
7673
|
-
}
|
|
7674
|
-
exports.decimal = decimal;
|
|
7675
|
-
}
|
|
7411
|
+
// src/serializer/pgSerializer.ts
|
|
7412
|
+
var pgSerializer_exports = {};
|
|
7413
|
+
__export(pgSerializer_exports, {
|
|
7414
|
+
generatePgSnapshot: () => generatePgSnapshot
|
|
7676
7415
|
});
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7416
|
+
var import_utils, import_sql, import_table, generatePgSnapshot;
|
|
7417
|
+
var init_pgSerializer = __esm({
|
|
7418
|
+
"src/serializer/pgSerializer.ts"() {
|
|
7419
|
+
import_utils = require("drizzle-orm-pg/utils");
|
|
7420
|
+
import_sql = require("drizzle-orm/sql");
|
|
7421
|
+
import_table = require("drizzle-orm/table");
|
|
7422
|
+
generatePgSnapshot = (tables, enums) => {
|
|
7423
|
+
const result = {};
|
|
7424
|
+
for (const table4 of tables) {
|
|
7425
|
+
const tableName = (0, import_table.getTableName)(table4);
|
|
7426
|
+
const columnsObject = {};
|
|
7427
|
+
const indexesObject = {};
|
|
7428
|
+
const foreignKeysObject = {};
|
|
7429
|
+
(0, import_utils.getTableColumns)(table4).forEach((column4) => {
|
|
7430
|
+
const notNull = column4.notNull;
|
|
7431
|
+
const primaryKey = column4.primary;
|
|
7432
|
+
const columnToSet = {
|
|
7433
|
+
name: column4.name,
|
|
7434
|
+
type: column4.getSQLType(),
|
|
7435
|
+
primaryKey,
|
|
7436
|
+
notNull
|
|
7437
|
+
};
|
|
7438
|
+
if (column4.default !== void 0) {
|
|
7439
|
+
if (column4.default instanceof import_sql.SQL) {
|
|
7440
|
+
columnToSet.default = column4.default.queryChunks.map((it) => {
|
|
7441
|
+
if (typeof it === "string") {
|
|
7442
|
+
return `${it}`;
|
|
7443
|
+
}
|
|
7444
|
+
throw new Error("Only strings are allowed in .default()");
|
|
7445
|
+
}).join();
|
|
7446
|
+
} else {
|
|
7447
|
+
columnToSet.default = typeof column4.default === "string" ? `'${column4.default}'` : column4.default;
|
|
7448
|
+
}
|
|
7449
|
+
}
|
|
7450
|
+
columnsObject[column4.name] = columnToSet;
|
|
7451
|
+
});
|
|
7452
|
+
const foreignKeys = (0, import_utils.getTableForeignKeys)(table4).map((fk4) => {
|
|
7453
|
+
const name = fk4.getName();
|
|
7454
|
+
const tableFrom = tableName;
|
|
7455
|
+
const onDelete = fk4.onDelete;
|
|
7456
|
+
const onUpdate = fk4.onUpdate;
|
|
7457
|
+
const reference = fk4.reference();
|
|
7458
|
+
const tableTo = (0, import_table.getTableName)(reference.foreignTable);
|
|
7459
|
+
const columnsFrom = reference.columns.map((it) => it.name);
|
|
7460
|
+
const columnsTo = reference.foreignColumns.map((it) => it.name);
|
|
7461
|
+
return {
|
|
7462
|
+
name,
|
|
7463
|
+
tableFrom,
|
|
7464
|
+
tableTo,
|
|
7465
|
+
columnsFrom,
|
|
7466
|
+
columnsTo,
|
|
7467
|
+
onDelete,
|
|
7468
|
+
onUpdate
|
|
7469
|
+
};
|
|
7470
|
+
});
|
|
7471
|
+
foreignKeys.forEach((it) => {
|
|
7472
|
+
foreignKeysObject[it.name] = it;
|
|
7473
|
+
});
|
|
7474
|
+
(0, import_utils.getTableIndexes)(table4).forEach((value) => {
|
|
7475
|
+
var _a;
|
|
7476
|
+
const columns = value.columns;
|
|
7477
|
+
const name = value.name;
|
|
7478
|
+
let indexColumns = columns.map((it) => it.name);
|
|
7479
|
+
indexesObject[name] = {
|
|
7480
|
+
name,
|
|
7481
|
+
columns: indexColumns,
|
|
7482
|
+
isUnique: (_a = value.config.unique) != null ? _a : false
|
|
7483
|
+
};
|
|
7484
|
+
});
|
|
7485
|
+
result[tableName] = {
|
|
7486
|
+
name: tableName,
|
|
7487
|
+
columns: columnsObject,
|
|
7488
|
+
indexes: indexesObject,
|
|
7489
|
+
foreignKeys: foreignKeysObject
|
|
7490
|
+
};
|
|
7704
7491
|
}
|
|
7492
|
+
const enumsToReturn = enums.reduce((map, obj) => {
|
|
7493
|
+
const key = obj.enumName;
|
|
7494
|
+
const newValues = obj.enumValues.reduce((mapped, value) => {
|
|
7495
|
+
mapped[value] = value;
|
|
7496
|
+
return mapped;
|
|
7497
|
+
}, {});
|
|
7498
|
+
map[key] = { name: obj.enumName, values: newValues };
|
|
7499
|
+
return map;
|
|
7500
|
+
}, {});
|
|
7501
|
+
return { version: "3", dialect: "pg", tables: result, enums: enumsToReturn };
|
|
7705
7502
|
};
|
|
7706
|
-
exports.MySqlDouble = MySqlDouble;
|
|
7707
|
-
function double(name, config) {
|
|
7708
|
-
return new MySqlDoubleBuilder(name, config === null || config === void 0 ? void 0 : config.precision, config === null || config === void 0 ? void 0 : config.scale);
|
|
7709
|
-
}
|
|
7710
|
-
exports.double = double;
|
|
7711
7503
|
}
|
|
7712
7504
|
});
|
|
7713
7505
|
|
|
7714
|
-
//
|
|
7715
|
-
var
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7719
|
-
exports.mysqlEnum = exports.MySqlEnumColumn = exports.MySqlEnumBuilder = void 0;
|
|
7720
|
-
var common_1 = require_common2();
|
|
7721
|
-
var MySqlEnumBuilder = class extends common_1.MySqlColumnBuilder {
|
|
7722
|
-
constructor(name, values) {
|
|
7723
|
-
super(name);
|
|
7724
|
-
this.values = values;
|
|
7725
|
-
}
|
|
7726
|
-
build(table4) {
|
|
7727
|
-
return new MySqlEnumColumn(table4, this, this.values);
|
|
7728
|
-
}
|
|
7729
|
-
};
|
|
7730
|
-
exports.MySqlEnumBuilder = MySqlEnumBuilder;
|
|
7731
|
-
var MySqlEnumColumn = class extends common_1.MySqlColumn {
|
|
7732
|
-
constructor(table4, builder, values) {
|
|
7733
|
-
super(table4, builder);
|
|
7734
|
-
this.values = values;
|
|
7735
|
-
}
|
|
7736
|
-
getSQLType() {
|
|
7737
|
-
return `(${this.values.map((it) => `'${it}'`).join(",")})`;
|
|
7738
|
-
}
|
|
7739
|
-
};
|
|
7740
|
-
exports.MySqlEnumColumn = MySqlEnumColumn;
|
|
7741
|
-
function mysqlEnum(name, config) {
|
|
7742
|
-
return new MySqlEnumBuilder(name, config.values);
|
|
7743
|
-
}
|
|
7744
|
-
exports.mysqlEnum = mysqlEnum;
|
|
7745
|
-
}
|
|
7506
|
+
// src/serializer/sqliteSerializer.ts
|
|
7507
|
+
var sqliteSerializer_exports = {};
|
|
7508
|
+
__export(sqliteSerializer_exports, {
|
|
7509
|
+
generateSqliteSnapshot: () => generateSqliteSnapshot
|
|
7746
7510
|
});
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7511
|
+
var import_table2, import_sql2, import_drizzle_orm_sqlite2, import_utils2, dialect4, generateSqliteSnapshot;
|
|
7512
|
+
var init_sqliteSerializer = __esm({
|
|
7513
|
+
"src/serializer/sqliteSerializer.ts"() {
|
|
7514
|
+
import_table2 = require("drizzle-orm/table");
|
|
7515
|
+
import_sql2 = require("drizzle-orm/sql");
|
|
7516
|
+
import_drizzle_orm_sqlite2 = require("drizzle-orm-sqlite");
|
|
7517
|
+
import_utils2 = require("drizzle-orm-sqlite/utils");
|
|
7518
|
+
dialect4 = new import_drizzle_orm_sqlite2.SQLiteSyncDialect();
|
|
7519
|
+
generateSqliteSnapshot = (tables, enums) => {
|
|
7520
|
+
const result = {};
|
|
7521
|
+
for (const table4 of tables) {
|
|
7522
|
+
const tableName = (0, import_table2.getTableName)(table4);
|
|
7523
|
+
const columnsObject = {};
|
|
7524
|
+
const indexesObject = {};
|
|
7525
|
+
const foreignKeysObject = {};
|
|
7526
|
+
(0, import_utils2.getTableColumns)(table4).forEach((column4) => {
|
|
7527
|
+
const notNull = column4.notNull;
|
|
7528
|
+
const primaryKey = column4.primary;
|
|
7529
|
+
const columnToSet = {
|
|
7530
|
+
name: column4.name,
|
|
7531
|
+
type: column4.getSQLType(),
|
|
7532
|
+
primaryKey,
|
|
7533
|
+
notNull
|
|
7534
|
+
};
|
|
7535
|
+
if (column4.default !== void 0) {
|
|
7536
|
+
if (column4.default instanceof import_sql2.SQL) {
|
|
7537
|
+
columnToSet.default = column4.default.queryChunks.map((it) => {
|
|
7538
|
+
if (typeof it === "string") {
|
|
7539
|
+
return `${it}`;
|
|
7540
|
+
}
|
|
7541
|
+
throw new Error("Only strings are allowed in .default()");
|
|
7542
|
+
}).join();
|
|
7543
|
+
} else {
|
|
7544
|
+
columnToSet.default = typeof column4.default === "string" ? `'${column4.default}'` : column4.default;
|
|
7545
|
+
}
|
|
7546
|
+
if (["blob", "text", "json"].includes(column4.getSQLType())) {
|
|
7547
|
+
columnToSet.default = `(${columnToSet.default})`;
|
|
7548
|
+
}
|
|
7549
|
+
}
|
|
7550
|
+
columnsObject[column4.name] = columnToSet;
|
|
7551
|
+
});
|
|
7552
|
+
const foreignKeys = (0, import_utils2.getTableForeignKeys)(table4).map((fk4) => {
|
|
7553
|
+
const name = fk4.getName();
|
|
7554
|
+
const tableFrom = tableName;
|
|
7555
|
+
const onDelete = fk4.onDelete;
|
|
7556
|
+
const onUpdate = fk4.onUpdate;
|
|
7557
|
+
const reference = fk4.reference();
|
|
7558
|
+
const referenceFT = reference.foreignTable;
|
|
7559
|
+
const tableTo = (0, import_table2.getTableName)(referenceFT);
|
|
7560
|
+
const columnsFrom = reference.columns.map((it) => it.name);
|
|
7561
|
+
const columnsTo = reference.foreignColumns.map((it) => it.name);
|
|
7562
|
+
return {
|
|
7563
|
+
name,
|
|
7564
|
+
tableFrom,
|
|
7565
|
+
tableTo,
|
|
7566
|
+
columnsFrom,
|
|
7567
|
+
columnsTo,
|
|
7568
|
+
onDelete,
|
|
7569
|
+
onUpdate
|
|
7570
|
+
};
|
|
7571
|
+
});
|
|
7572
|
+
foreignKeys.forEach((it) => {
|
|
7573
|
+
foreignKeysObject[it.name] = it;
|
|
7574
|
+
});
|
|
7575
|
+
(0, import_utils2.getTableIndexes)(table4).forEach((value) => {
|
|
7576
|
+
var _a;
|
|
7577
|
+
const columns = value.config.columns;
|
|
7578
|
+
const name = value.config.name;
|
|
7579
|
+
let indexColumns = columns.map((it) => {
|
|
7580
|
+
if (it instanceof import_sql2.SQL) {
|
|
7581
|
+
return dialect4.sqlToQuery(it).sql;
|
|
7582
|
+
} else {
|
|
7583
|
+
return it.name;
|
|
7584
|
+
}
|
|
7585
|
+
});
|
|
7586
|
+
let where = void 0;
|
|
7587
|
+
if (value.config.where !== void 0) {
|
|
7588
|
+
if (value.config.where instanceof import_sql2.SQL) {
|
|
7589
|
+
where = dialect4.sqlToQuery(value.config.where).sql;
|
|
7590
|
+
}
|
|
7591
|
+
}
|
|
7592
|
+
indexesObject[name] = {
|
|
7593
|
+
name,
|
|
7594
|
+
columns: indexColumns,
|
|
7595
|
+
isUnique: (_a = value.config.unique) != null ? _a : false,
|
|
7596
|
+
where
|
|
7597
|
+
};
|
|
7598
|
+
});
|
|
7599
|
+
result[tableName] = {
|
|
7600
|
+
name: tableName,
|
|
7601
|
+
columns: columnsObject,
|
|
7602
|
+
indexes: indexesObject,
|
|
7603
|
+
foreignKeys: foreignKeysObject
|
|
7604
|
+
};
|
|
7774
7605
|
}
|
|
7606
|
+
return { version: "3", dialect: "sqlite", tables: result, enums: {} };
|
|
7775
7607
|
};
|
|
7776
|
-
exports.MySqlFloat = MySqlFloat;
|
|
7777
|
-
function float(name) {
|
|
7778
|
-
return new MySqlFloatBuilder(name);
|
|
7779
|
-
}
|
|
7780
|
-
exports.float = float;
|
|
7781
7608
|
}
|
|
7782
7609
|
});
|
|
7783
7610
|
|
|
7784
|
-
// node_modules/.pnpm/
|
|
7785
|
-
var
|
|
7786
|
-
"node_modules/.pnpm/
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
return new MySqlInteger(table4, this);
|
|
7794
|
-
}
|
|
7795
|
-
};
|
|
7796
|
-
exports.MySqlIntegerBuilder = MySqlIntegerBuilder;
|
|
7797
|
-
var MySqlInteger = class extends common_1.MySqlColumnWithAutoIncrement {
|
|
7798
|
-
getSQLType() {
|
|
7799
|
-
return "int";
|
|
7800
|
-
}
|
|
7801
|
-
mapFromDriverValue(value) {
|
|
7802
|
-
if (typeof value === "string") {
|
|
7803
|
-
return parseInt(value);
|
|
7611
|
+
// node_modules/.pnpm/heap@0.2.7/node_modules/heap/lib/heap.js
|
|
7612
|
+
var require_heap = __commonJS({
|
|
7613
|
+
"node_modules/.pnpm/heap@0.2.7/node_modules/heap/lib/heap.js"(exports, module2) {
|
|
7614
|
+
(function() {
|
|
7615
|
+
var Heap, defaultCmp, floor, heapify, heappop, heappush, heappushpop, heapreplace, insort, min, nlargest, nsmallest, updateItem, _siftdown, _siftup;
|
|
7616
|
+
floor = Math.floor, min = Math.min;
|
|
7617
|
+
defaultCmp = function(x, y) {
|
|
7618
|
+
if (x < y) {
|
|
7619
|
+
return -1;
|
|
7804
7620
|
}
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
};
|
|
7808
|
-
exports.MySqlInteger = MySqlInteger;
|
|
7809
|
-
function int(name) {
|
|
7810
|
-
return new MySqlIntegerBuilder(name);
|
|
7811
|
-
}
|
|
7812
|
-
exports.int = int;
|
|
7813
|
-
}
|
|
7814
|
-
});
|
|
7815
|
-
|
|
7816
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/json.js
|
|
7817
|
-
var require_json = __commonJS({
|
|
7818
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/json.js"(exports) {
|
|
7819
|
-
"use strict";
|
|
7820
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7821
|
-
exports.json = exports.MySqlJson = exports.MySqlJsonBuilder = void 0;
|
|
7822
|
-
var common_1 = require_common2();
|
|
7823
|
-
var MySqlJsonBuilder = class extends common_1.MySqlColumnBuilder {
|
|
7824
|
-
constructor(name) {
|
|
7825
|
-
super(name);
|
|
7826
|
-
}
|
|
7827
|
-
build(table4) {
|
|
7828
|
-
return new MySqlJson(table4, this);
|
|
7829
|
-
}
|
|
7830
|
-
};
|
|
7831
|
-
exports.MySqlJsonBuilder = MySqlJsonBuilder;
|
|
7832
|
-
var MySqlJson = class extends common_1.MySqlColumn {
|
|
7833
|
-
constructor(table4, builder) {
|
|
7834
|
-
super(table4, builder);
|
|
7835
|
-
}
|
|
7836
|
-
getSQLType() {
|
|
7837
|
-
return "json";
|
|
7838
|
-
}
|
|
7839
|
-
mapToDriverValue(value) {
|
|
7840
|
-
return JSON.stringify(value);
|
|
7841
|
-
}
|
|
7842
|
-
};
|
|
7843
|
-
exports.MySqlJson = MySqlJson;
|
|
7844
|
-
function json(name) {
|
|
7845
|
-
return new MySqlJsonBuilder(name);
|
|
7846
|
-
}
|
|
7847
|
-
exports.json = json;
|
|
7848
|
-
}
|
|
7849
|
-
});
|
|
7850
|
-
|
|
7851
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/mediumint.js
|
|
7852
|
-
var require_mediumint = __commonJS({
|
|
7853
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/mediumint.js"(exports) {
|
|
7854
|
-
"use strict";
|
|
7855
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7856
|
-
exports.mediumint = exports.MySqlMediumInt = exports.MySqlMediumIntBuilder = void 0;
|
|
7857
|
-
var common_1 = require_common2();
|
|
7858
|
-
var MySqlMediumIntBuilder = class extends common_1.MySqlColumnBuilderWithAutoIncrement {
|
|
7859
|
-
build(table4) {
|
|
7860
|
-
return new MySqlMediumInt(table4, this);
|
|
7861
|
-
}
|
|
7862
|
-
};
|
|
7863
|
-
exports.MySqlMediumIntBuilder = MySqlMediumIntBuilder;
|
|
7864
|
-
var MySqlMediumInt = class extends common_1.MySqlColumnWithAutoIncrement {
|
|
7865
|
-
getSQLType() {
|
|
7866
|
-
return "mediumint";
|
|
7867
|
-
}
|
|
7868
|
-
mapFromDriverValue(value) {
|
|
7869
|
-
if (typeof value === "string") {
|
|
7870
|
-
return parseInt(value);
|
|
7621
|
+
if (x > y) {
|
|
7622
|
+
return 1;
|
|
7871
7623
|
}
|
|
7872
|
-
return
|
|
7873
|
-
}
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
}
|
|
7879
|
-
exports.mediumint = mediumint;
|
|
7880
|
-
}
|
|
7881
|
-
});
|
|
7882
|
-
|
|
7883
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/real.js
|
|
7884
|
-
var require_real = __commonJS({
|
|
7885
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/real.js"(exports) {
|
|
7886
|
-
"use strict";
|
|
7887
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7888
|
-
exports.real = exports.MySqlReal = exports.MySqlRealBuilder = void 0;
|
|
7889
|
-
var common_1 = require_common2();
|
|
7890
|
-
var MySqlRealBuilder = class extends common_1.MySqlColumnBuilder {
|
|
7891
|
-
constructor(name, precision, scale) {
|
|
7892
|
-
super(name);
|
|
7893
|
-
this.precision = precision;
|
|
7894
|
-
this.scale = scale;
|
|
7895
|
-
}
|
|
7896
|
-
build(table4) {
|
|
7897
|
-
return new MySqlReal(table4, this);
|
|
7898
|
-
}
|
|
7899
|
-
};
|
|
7900
|
-
exports.MySqlRealBuilder = MySqlRealBuilder;
|
|
7901
|
-
var MySqlReal = class extends common_1.MySqlColumn {
|
|
7902
|
-
constructor(table4, builder) {
|
|
7903
|
-
super(table4, builder);
|
|
7904
|
-
this.precision = builder.precision;
|
|
7905
|
-
this.scale = builder.scale;
|
|
7906
|
-
}
|
|
7907
|
-
getSQLType() {
|
|
7908
|
-
if (typeof this.precision !== "undefined" && typeof this.scale !== "undefined") {
|
|
7909
|
-
return `real(${this.precision}, ${this.scale})`;
|
|
7910
|
-
} else if (typeof this.precision === "undefined") {
|
|
7911
|
-
return "real";
|
|
7912
|
-
} else {
|
|
7913
|
-
return `real(${this.precision})`;
|
|
7914
|
-
}
|
|
7915
|
-
}
|
|
7916
|
-
};
|
|
7917
|
-
exports.MySqlReal = MySqlReal;
|
|
7918
|
-
function real(name, config = {}) {
|
|
7919
|
-
return new MySqlRealBuilder(name, config.precision, config.scale);
|
|
7920
|
-
}
|
|
7921
|
-
exports.real = real;
|
|
7922
|
-
}
|
|
7923
|
-
});
|
|
7924
|
-
|
|
7925
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/serial.js
|
|
7926
|
-
var require_serial = __commonJS({
|
|
7927
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/serial.js"(exports) {
|
|
7928
|
-
"use strict";
|
|
7929
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7930
|
-
exports.serial = exports.MySqlSerial = exports.MySqlSerialBuilder = void 0;
|
|
7931
|
-
var common_1 = require_common2();
|
|
7932
|
-
var MySqlSerialBuilder = class extends common_1.MySqlColumnBuilder {
|
|
7933
|
-
build(table4) {
|
|
7934
|
-
return new MySqlSerial(table4, this);
|
|
7935
|
-
}
|
|
7936
|
-
};
|
|
7937
|
-
exports.MySqlSerialBuilder = MySqlSerialBuilder;
|
|
7938
|
-
var MySqlSerial = class extends common_1.MySqlColumn {
|
|
7939
|
-
getSQLType() {
|
|
7940
|
-
return "serial";
|
|
7941
|
-
}
|
|
7942
|
-
mapFromDriverValue(value) {
|
|
7943
|
-
if (typeof value === "string") {
|
|
7944
|
-
return parseInt(value);
|
|
7945
|
-
}
|
|
7946
|
-
return value;
|
|
7947
|
-
}
|
|
7948
|
-
};
|
|
7949
|
-
exports.MySqlSerial = MySqlSerial;
|
|
7950
|
-
function serial(name) {
|
|
7951
|
-
return new MySqlSerialBuilder(name);
|
|
7952
|
-
}
|
|
7953
|
-
exports.serial = serial;
|
|
7954
|
-
}
|
|
7955
|
-
});
|
|
7956
|
-
|
|
7957
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/smallint.js
|
|
7958
|
-
var require_smallint = __commonJS({
|
|
7959
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/smallint.js"(exports) {
|
|
7960
|
-
"use strict";
|
|
7961
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7962
|
-
exports.smallint = exports.MySqlSmallInt = exports.MySqlSmallIntBuilder = void 0;
|
|
7963
|
-
var common_1 = require_common2();
|
|
7964
|
-
var MySqlSmallIntBuilder = class extends common_1.MySqlColumnBuilderWithAutoIncrement {
|
|
7965
|
-
build(table4) {
|
|
7966
|
-
return new MySqlSmallInt(table4, this);
|
|
7967
|
-
}
|
|
7968
|
-
};
|
|
7969
|
-
exports.MySqlSmallIntBuilder = MySqlSmallIntBuilder;
|
|
7970
|
-
var MySqlSmallInt = class extends common_1.MySqlColumnWithAutoIncrement {
|
|
7971
|
-
getSQLType() {
|
|
7972
|
-
return "smallint";
|
|
7973
|
-
}
|
|
7974
|
-
mapFromDriverValue(value) {
|
|
7975
|
-
if (typeof value === "string") {
|
|
7976
|
-
return parseInt(value);
|
|
7977
|
-
}
|
|
7978
|
-
return value;
|
|
7979
|
-
}
|
|
7980
|
-
};
|
|
7981
|
-
exports.MySqlSmallInt = MySqlSmallInt;
|
|
7982
|
-
function smallint(name) {
|
|
7983
|
-
return new MySqlSmallIntBuilder(name);
|
|
7984
|
-
}
|
|
7985
|
-
exports.smallint = smallint;
|
|
7986
|
-
}
|
|
7987
|
-
});
|
|
7988
|
-
|
|
7989
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/text.js
|
|
7990
|
-
var require_text = __commonJS({
|
|
7991
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/text.js"(exports) {
|
|
7992
|
-
"use strict";
|
|
7993
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7994
|
-
exports.longtext = exports.mediumtext = exports.tinytext = exports.text = exports.MySqlText = exports.MySqlTextBuilder = void 0;
|
|
7995
|
-
var common_1 = require_common2();
|
|
7996
|
-
var MySqlTextBuilder = class extends common_1.MySqlColumnBuilder {
|
|
7997
|
-
constructor(name, textType) {
|
|
7998
|
-
super(name);
|
|
7999
|
-
this.textType = textType;
|
|
8000
|
-
}
|
|
8001
|
-
build(table4) {
|
|
8002
|
-
return new MySqlText(table4, this);
|
|
8003
|
-
}
|
|
8004
|
-
};
|
|
8005
|
-
exports.MySqlTextBuilder = MySqlTextBuilder;
|
|
8006
|
-
var MySqlText = class extends common_1.MySqlColumn {
|
|
8007
|
-
constructor(table4, builder) {
|
|
8008
|
-
super(table4, builder);
|
|
8009
|
-
this.textType = builder.textType;
|
|
8010
|
-
}
|
|
8011
|
-
getSQLType() {
|
|
8012
|
-
return this.textType;
|
|
8013
|
-
}
|
|
8014
|
-
};
|
|
8015
|
-
exports.MySqlText = MySqlText;
|
|
8016
|
-
function text(name) {
|
|
8017
|
-
return new MySqlTextBuilder(name, "text");
|
|
8018
|
-
}
|
|
8019
|
-
exports.text = text;
|
|
8020
|
-
function tinytext(name) {
|
|
8021
|
-
return new MySqlTextBuilder(name, "tinytext");
|
|
8022
|
-
}
|
|
8023
|
-
exports.tinytext = tinytext;
|
|
8024
|
-
function mediumtext(name) {
|
|
8025
|
-
return new MySqlTextBuilder(name, "mediumtext");
|
|
8026
|
-
}
|
|
8027
|
-
exports.mediumtext = mediumtext;
|
|
8028
|
-
function longtext(name) {
|
|
8029
|
-
return new MySqlTextBuilder(name, "longtext");
|
|
8030
|
-
}
|
|
8031
|
-
exports.longtext = longtext;
|
|
8032
|
-
}
|
|
8033
|
-
});
|
|
8034
|
-
|
|
8035
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/date.common.js
|
|
8036
|
-
var require_date_common = __commonJS({
|
|
8037
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/date.common.js"(exports) {
|
|
8038
|
-
"use strict";
|
|
8039
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8040
|
-
exports.MySqlDateBaseColumn = exports.MySqlDateColumnBaseBuilder = void 0;
|
|
8041
|
-
var drizzle_orm_1 = require("drizzle-orm");
|
|
8042
|
-
var common_1 = require_common2();
|
|
8043
|
-
var MySqlDateColumnBaseBuilder = class extends common_1.MySqlColumnBuilder {
|
|
8044
|
-
constructor() {
|
|
8045
|
-
super(...arguments);
|
|
8046
|
-
this.hasOnUpdateNow = false;
|
|
8047
|
-
}
|
|
8048
|
-
notNull() {
|
|
8049
|
-
return super.notNull();
|
|
8050
|
-
}
|
|
8051
|
-
default(value) {
|
|
8052
|
-
return super.default(value);
|
|
8053
|
-
}
|
|
8054
|
-
primaryKey() {
|
|
8055
|
-
return super.primaryKey();
|
|
8056
|
-
}
|
|
8057
|
-
defaultNow() {
|
|
8058
|
-
return this.default((0, drizzle_orm_1.sql)`now()`);
|
|
8059
|
-
}
|
|
8060
|
-
onUpdateNow() {
|
|
8061
|
-
this.hasOnUpdateNow = true;
|
|
8062
|
-
return this;
|
|
8063
|
-
}
|
|
8064
|
-
};
|
|
8065
|
-
exports.MySqlDateColumnBaseBuilder = MySqlDateColumnBaseBuilder;
|
|
8066
|
-
var MySqlDateBaseColumn = class extends common_1.MySqlColumn {
|
|
8067
|
-
constructor(table4, builder) {
|
|
8068
|
-
super(table4, builder);
|
|
8069
|
-
this.hasOnUpdateNow = builder.hasOnUpdateNow;
|
|
8070
|
-
}
|
|
8071
|
-
};
|
|
8072
|
-
exports.MySqlDateBaseColumn = MySqlDateBaseColumn;
|
|
8073
|
-
}
|
|
8074
|
-
});
|
|
8075
|
-
|
|
8076
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/timestamp.js
|
|
8077
|
-
var require_timestamp = __commonJS({
|
|
8078
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/timestamp.js"(exports) {
|
|
8079
|
-
"use strict";
|
|
8080
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8081
|
-
exports.timestamp = exports.MySqlTimestampString = exports.MySqlTimestampStringBuilder = exports.MySqlTimestamp = exports.MySqlTimestampBuilder = void 0;
|
|
8082
|
-
var date_common_1 = require_date_common();
|
|
8083
|
-
var MySqlTimestampBuilder = class extends date_common_1.MySqlDateColumnBaseBuilder {
|
|
8084
|
-
constructor(name, fsp) {
|
|
8085
|
-
super(name);
|
|
8086
|
-
this.fsp = fsp;
|
|
8087
|
-
}
|
|
8088
|
-
build(table4) {
|
|
8089
|
-
return new MySqlTimestamp(table4, this);
|
|
8090
|
-
}
|
|
8091
|
-
};
|
|
8092
|
-
exports.MySqlTimestampBuilder = MySqlTimestampBuilder;
|
|
8093
|
-
var MySqlTimestamp = class extends date_common_1.MySqlDateBaseColumn {
|
|
8094
|
-
constructor(table4, builder) {
|
|
8095
|
-
super(table4, builder);
|
|
8096
|
-
this.fsp = builder.fsp;
|
|
8097
|
-
}
|
|
8098
|
-
getSQLType() {
|
|
8099
|
-
const precision = typeof this.fsp !== "undefined" ? ` (${this.fsp})` : "";
|
|
8100
|
-
return `timestamp${precision}`;
|
|
8101
|
-
}
|
|
8102
|
-
mapFromDriverValue(value) {
|
|
8103
|
-
return new Date(value);
|
|
8104
|
-
}
|
|
8105
|
-
};
|
|
8106
|
-
exports.MySqlTimestamp = MySqlTimestamp;
|
|
8107
|
-
var MySqlTimestampStringBuilder = class extends date_common_1.MySqlDateColumnBaseBuilder {
|
|
8108
|
-
constructor(name, fsp) {
|
|
8109
|
-
super(name);
|
|
8110
|
-
this.fsp = fsp;
|
|
8111
|
-
}
|
|
8112
|
-
build(table4) {
|
|
8113
|
-
return new MySqlTimestampString(table4, this);
|
|
8114
|
-
}
|
|
8115
|
-
};
|
|
8116
|
-
exports.MySqlTimestampStringBuilder = MySqlTimestampStringBuilder;
|
|
8117
|
-
var MySqlTimestampString = class extends date_common_1.MySqlDateBaseColumn {
|
|
8118
|
-
constructor(table4, builder) {
|
|
8119
|
-
super(table4, builder);
|
|
8120
|
-
this.fsp = builder.fsp;
|
|
8121
|
-
}
|
|
8122
|
-
getSQLType() {
|
|
8123
|
-
const precision = typeof this.fsp !== "undefined" ? ` (${this.fsp})` : "";
|
|
8124
|
-
return `timestamp${precision}`;
|
|
8125
|
-
}
|
|
8126
|
-
};
|
|
8127
|
-
exports.MySqlTimestampString = MySqlTimestampString;
|
|
8128
|
-
function timestamp(name, config) {
|
|
8129
|
-
if ((config === null || config === void 0 ? void 0 : config.mode) === "string") {
|
|
8130
|
-
return new MySqlTimestampStringBuilder(name, config.fsp);
|
|
8131
|
-
}
|
|
8132
|
-
return new MySqlTimestampBuilder(name, config === null || config === void 0 ? void 0 : config.fsp);
|
|
8133
|
-
}
|
|
8134
|
-
exports.timestamp = timestamp;
|
|
8135
|
-
}
|
|
8136
|
-
});
|
|
8137
|
-
|
|
8138
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/tinyint.js
|
|
8139
|
-
var require_tinyint = __commonJS({
|
|
8140
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/tinyint.js"(exports) {
|
|
8141
|
-
"use strict";
|
|
8142
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8143
|
-
exports.tinyint = exports.MySqlTinyInt = exports.MySqlTinyIntBuilder = void 0;
|
|
8144
|
-
var common_1 = require_common2();
|
|
8145
|
-
var MySqlTinyIntBuilder = class extends common_1.MySqlColumnBuilder {
|
|
8146
|
-
build(table4) {
|
|
8147
|
-
return new MySqlTinyInt(table4, this);
|
|
8148
|
-
}
|
|
8149
|
-
};
|
|
8150
|
-
exports.MySqlTinyIntBuilder = MySqlTinyIntBuilder;
|
|
8151
|
-
var MySqlTinyInt = class extends common_1.MySqlColumn {
|
|
8152
|
-
getSQLType() {
|
|
8153
|
-
return "tinyint";
|
|
8154
|
-
}
|
|
8155
|
-
mapFromDriverValue(value) {
|
|
8156
|
-
if (typeof value === "string") {
|
|
8157
|
-
return parseInt(value);
|
|
8158
|
-
}
|
|
8159
|
-
return value;
|
|
8160
|
-
}
|
|
8161
|
-
};
|
|
8162
|
-
exports.MySqlTinyInt = MySqlTinyInt;
|
|
8163
|
-
function tinyint(name) {
|
|
8164
|
-
return new MySqlTinyIntBuilder(name);
|
|
8165
|
-
}
|
|
8166
|
-
exports.tinyint = tinyint;
|
|
8167
|
-
}
|
|
8168
|
-
});
|
|
8169
|
-
|
|
8170
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/varbinary.js
|
|
8171
|
-
var require_varbinary = __commonJS({
|
|
8172
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/varbinary.js"(exports) {
|
|
8173
|
-
"use strict";
|
|
8174
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8175
|
-
exports.varbinary = exports.MySqlVarBinary = exports.MySqlVarBinaryBuilder = void 0;
|
|
8176
|
-
var common_1 = require_common2();
|
|
8177
|
-
var MySqlVarBinaryBuilder = class extends common_1.MySqlColumnBuilder {
|
|
8178
|
-
constructor(name, length) {
|
|
8179
|
-
super(name);
|
|
8180
|
-
this.length = length;
|
|
8181
|
-
}
|
|
8182
|
-
build(table4) {
|
|
8183
|
-
return new MySqlVarBinary(table4, this);
|
|
8184
|
-
}
|
|
8185
|
-
};
|
|
8186
|
-
exports.MySqlVarBinaryBuilder = MySqlVarBinaryBuilder;
|
|
8187
|
-
var MySqlVarBinary = class extends common_1.MySqlColumn {
|
|
8188
|
-
constructor(table4, builder) {
|
|
8189
|
-
super(table4, builder);
|
|
8190
|
-
this.length = builder.length;
|
|
8191
|
-
}
|
|
8192
|
-
getSQLType() {
|
|
8193
|
-
return typeof this.length !== "undefined" ? `varbinary(${this.length})` : `varbinary`;
|
|
8194
|
-
}
|
|
8195
|
-
};
|
|
8196
|
-
exports.MySqlVarBinary = MySqlVarBinary;
|
|
8197
|
-
function varbinary(name, options) {
|
|
8198
|
-
return new MySqlVarBinaryBuilder(name, options.length);
|
|
8199
|
-
}
|
|
8200
|
-
exports.varbinary = varbinary;
|
|
8201
|
-
}
|
|
8202
|
-
});
|
|
8203
|
-
|
|
8204
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/varchar.js
|
|
8205
|
-
var require_varchar = __commonJS({
|
|
8206
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/varchar.js"(exports) {
|
|
8207
|
-
"use strict";
|
|
8208
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8209
|
-
exports.varchar = exports.MySqlVarChar = exports.MySqlVarCharBuilder = void 0;
|
|
8210
|
-
var common_1 = require_common2();
|
|
8211
|
-
var MySqlVarCharBuilder = class extends common_1.MySqlColumnBuilder {
|
|
8212
|
-
constructor(name, length) {
|
|
8213
|
-
super(name);
|
|
8214
|
-
this.length = length;
|
|
8215
|
-
}
|
|
8216
|
-
build(table4) {
|
|
8217
|
-
return new MySqlVarChar(table4, this);
|
|
8218
|
-
}
|
|
8219
|
-
};
|
|
8220
|
-
exports.MySqlVarCharBuilder = MySqlVarCharBuilder;
|
|
8221
|
-
var MySqlVarChar = class extends common_1.MySqlColumn {
|
|
8222
|
-
constructor(table4, builder) {
|
|
8223
|
-
super(table4, builder);
|
|
8224
|
-
this.length = builder.length;
|
|
8225
|
-
}
|
|
8226
|
-
getSQLType() {
|
|
8227
|
-
return typeof this.length !== "undefined" ? `varchar(${this.length})` : `varchar`;
|
|
8228
|
-
}
|
|
8229
|
-
};
|
|
8230
|
-
exports.MySqlVarChar = MySqlVarChar;
|
|
8231
|
-
function varchar(name, options) {
|
|
8232
|
-
return new MySqlVarCharBuilder(name, options.length);
|
|
8233
|
-
}
|
|
8234
|
-
exports.varchar = varchar;
|
|
8235
|
-
}
|
|
8236
|
-
});
|
|
8237
|
-
|
|
8238
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/index.js
|
|
8239
|
-
var require_columns = __commonJS({
|
|
8240
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/columns/index.js"(exports) {
|
|
8241
|
-
"use strict";
|
|
8242
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
8243
|
-
if (k2 === void 0)
|
|
8244
|
-
k2 = k;
|
|
8245
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8246
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8247
|
-
desc = { enumerable: true, get: function() {
|
|
8248
|
-
return m[k];
|
|
8249
|
-
} };
|
|
8250
|
-
}
|
|
8251
|
-
Object.defineProperty(o, k2, desc);
|
|
8252
|
-
} : function(o, m, k, k2) {
|
|
8253
|
-
if (k2 === void 0)
|
|
8254
|
-
k2 = k;
|
|
8255
|
-
o[k2] = m[k];
|
|
8256
|
-
});
|
|
8257
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
8258
|
-
for (var p in m)
|
|
8259
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
8260
|
-
__createBinding(exports2, m, p);
|
|
8261
|
-
};
|
|
8262
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8263
|
-
exports.MySqlColumn = void 0;
|
|
8264
|
-
__exportStar(require_bigint(), exports);
|
|
8265
|
-
__exportStar(require_binary(), exports);
|
|
8266
|
-
__exportStar(require_char(), exports);
|
|
8267
|
-
var common_1 = require_common2();
|
|
8268
|
-
Object.defineProperty(exports, "MySqlColumn", { enumerable: true, get: function() {
|
|
8269
|
-
return common_1.MySqlColumn;
|
|
8270
|
-
} });
|
|
8271
|
-
__exportStar(require_decimal(), exports);
|
|
8272
|
-
__exportStar(require_double(), exports);
|
|
8273
|
-
__exportStar(require_enum(), exports);
|
|
8274
|
-
__exportStar(require_float(), exports);
|
|
8275
|
-
__exportStar(require_int(), exports);
|
|
8276
|
-
__exportStar(require_json(), exports);
|
|
8277
|
-
__exportStar(require_mediumint(), exports);
|
|
8278
|
-
__exportStar(require_real(), exports);
|
|
8279
|
-
__exportStar(require_serial(), exports);
|
|
8280
|
-
__exportStar(require_smallint(), exports);
|
|
8281
|
-
__exportStar(require_text(), exports);
|
|
8282
|
-
__exportStar(require_timestamp(), exports);
|
|
8283
|
-
__exportStar(require_tinyint(), exports);
|
|
8284
|
-
__exportStar(require_varbinary(), exports);
|
|
8285
|
-
__exportStar(require_varchar(), exports);
|
|
8286
|
-
}
|
|
8287
|
-
});
|
|
8288
|
-
|
|
8289
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/indexes.js
|
|
8290
|
-
var require_indexes = __commonJS({
|
|
8291
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/indexes.js"(exports) {
|
|
8292
|
-
"use strict";
|
|
8293
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8294
|
-
exports.uniqueIndex = exports.index = exports.Index = exports.IndexBuilder = void 0;
|
|
8295
|
-
var IndexBuilder = class {
|
|
8296
|
-
constructor(name, columns, config = {}) {
|
|
8297
|
-
this.name = name;
|
|
8298
|
-
this.columns = columns;
|
|
8299
|
-
this.config = config;
|
|
8300
|
-
}
|
|
8301
|
-
build(table4) {
|
|
8302
|
-
return new Index2(this.name, table4, this.columns, this);
|
|
8303
|
-
}
|
|
8304
|
-
};
|
|
8305
|
-
exports.IndexBuilder = IndexBuilder;
|
|
8306
|
-
var Index2 = class {
|
|
8307
|
-
constructor(name, table4, columns, builder) {
|
|
8308
|
-
this.name = name;
|
|
8309
|
-
this.table = table4;
|
|
8310
|
-
this.columns = columns;
|
|
8311
|
-
this.config = builder.config;
|
|
8312
|
-
}
|
|
8313
|
-
};
|
|
8314
|
-
exports.Index = Index2;
|
|
8315
|
-
function index4(name, columns, config) {
|
|
8316
|
-
return new IndexBuilder(name, Array.isArray(columns) ? columns : [columns], config);
|
|
8317
|
-
}
|
|
8318
|
-
exports.index = index4;
|
|
8319
|
-
function uniqueIndex() {
|
|
8320
|
-
}
|
|
8321
|
-
exports.uniqueIndex = uniqueIndex;
|
|
8322
|
-
}
|
|
8323
|
-
});
|
|
8324
|
-
|
|
8325
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/utils.js
|
|
8326
|
-
var require_utils = __commonJS({
|
|
8327
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/utils.js"(exports) {
|
|
8328
|
-
"use strict";
|
|
8329
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8330
|
-
exports.getTableChecks = exports.getTableForeignKeys = exports.getTableIndexes = exports.getTableColumns = exports.tableChecks = exports.tableForeignKeys = exports.tableIndexes = void 0;
|
|
8331
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8332
|
-
exports.tableIndexes = Symbol("tableIndexes");
|
|
8333
|
-
exports.tableForeignKeys = Symbol("tableForeignKeys");
|
|
8334
|
-
exports.tableChecks = Symbol("tableChecks");
|
|
8335
|
-
function getTableColumns3(table4) {
|
|
8336
|
-
const keys = Reflect.ownKeys(table4[utils_1.tableColumns]);
|
|
8337
|
-
return keys.map((key) => table4[utils_1.tableColumns][key]);
|
|
8338
|
-
}
|
|
8339
|
-
exports.getTableColumns = getTableColumns3;
|
|
8340
|
-
function getTableIndexes3(table4) {
|
|
8341
|
-
const keys = Reflect.ownKeys(table4[exports.tableIndexes]);
|
|
8342
|
-
return keys.map((key) => table4[exports.tableIndexes][key]);
|
|
8343
|
-
}
|
|
8344
|
-
exports.getTableIndexes = getTableIndexes3;
|
|
8345
|
-
function getTableForeignKeys3(table4) {
|
|
8346
|
-
const keys = Reflect.ownKeys(table4[exports.tableForeignKeys]);
|
|
8347
|
-
return keys.map((key) => table4[exports.tableForeignKeys][key]);
|
|
8348
|
-
}
|
|
8349
|
-
exports.getTableForeignKeys = getTableForeignKeys3;
|
|
8350
|
-
function getTableChecks(table4) {
|
|
8351
|
-
const keys = Reflect.ownKeys(table4[exports.tableChecks]);
|
|
8352
|
-
return keys.map((key) => table4[exports.tableChecks][key]);
|
|
8353
|
-
}
|
|
8354
|
-
exports.getTableChecks = getTableChecks;
|
|
8355
|
-
}
|
|
8356
|
-
});
|
|
8357
|
-
|
|
8358
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/table.js
|
|
8359
|
-
var require_table = __commonJS({
|
|
8360
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/table.js"(exports) {
|
|
8361
|
-
"use strict";
|
|
8362
|
-
var _a;
|
|
8363
|
-
var _b;
|
|
8364
|
-
var _c;
|
|
8365
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8366
|
-
exports.mysqlTable = exports.MySqlTable = void 0;
|
|
8367
|
-
var table_1 = require("drizzle-orm/table");
|
|
8368
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8369
|
-
var checks_1 = require_checks();
|
|
8370
|
-
var foreign_keys_1 = require_foreign_keys();
|
|
8371
|
-
var indexes_1 = require_indexes();
|
|
8372
|
-
var utils_2 = require_utils();
|
|
8373
|
-
var MySqlTable2 = class extends table_1.Table {
|
|
8374
|
-
constructor() {
|
|
8375
|
-
super(...arguments);
|
|
8376
|
-
this[_a] = {};
|
|
8377
|
-
this[_b] = {};
|
|
8378
|
-
this[_c] = {};
|
|
8379
|
-
}
|
|
8380
|
-
};
|
|
8381
|
-
exports.MySqlTable = MySqlTable2;
|
|
8382
|
-
_a = utils_2.tableIndexes, _b = utils_2.tableForeignKeys, _c = utils_2.tableChecks;
|
|
8383
|
-
function mysqlTable(name, columns, extraConfig) {
|
|
8384
|
-
const rawTable = new MySqlTable2(name);
|
|
8385
|
-
const builtColumns = Object.fromEntries(Object.entries(columns).map(([name2, colBuilder]) => {
|
|
8386
|
-
const column4 = colBuilder.build(rawTable);
|
|
8387
|
-
colBuilder.buildForeignKeys(column4, rawTable).forEach((fk4, fkIndex) => {
|
|
8388
|
-
rawTable[utils_2.tableForeignKeys][Symbol(`${name2}_${fkIndex}`)] = fk4;
|
|
8389
|
-
});
|
|
8390
|
-
return [name2, column4];
|
|
8391
|
-
}));
|
|
8392
|
-
rawTable[utils_1.tableColumns] = builtColumns;
|
|
8393
|
-
const table4 = Object.assign(rawTable, builtColumns);
|
|
8394
|
-
table4[utils_1.tableColumns] = builtColumns;
|
|
8395
|
-
if (extraConfig) {
|
|
8396
|
-
const builtConfig = extraConfig(table4);
|
|
8397
|
-
Object.entries(builtConfig).forEach(([name2, builder]) => {
|
|
8398
|
-
if (builder instanceof indexes_1.IndexBuilder) {
|
|
8399
|
-
table4[utils_2.tableIndexes][name2] = builder.build(table4);
|
|
8400
|
-
} else if (builder instanceof checks_1.CheckBuilder) {
|
|
8401
|
-
table4[utils_2.tableChecks][name2] = builder.build(table4);
|
|
8402
|
-
} else if (builder instanceof foreign_keys_1.ForeignKeyBuilder) {
|
|
8403
|
-
table4[utils_2.tableForeignKeys][name2] = builder.build(table4);
|
|
8404
|
-
}
|
|
8405
|
-
});
|
|
8406
|
-
}
|
|
8407
|
-
return table4;
|
|
8408
|
-
}
|
|
8409
|
-
exports.mysqlTable = mysqlTable;
|
|
8410
|
-
}
|
|
8411
|
-
});
|
|
8412
|
-
|
|
8413
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/proxies/index.js
|
|
8414
|
-
var require_proxies = __commonJS({
|
|
8415
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/proxies/index.js"(exports) {
|
|
8416
|
-
"use strict";
|
|
8417
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8418
|
-
exports.TableProxyHandler = exports.ColumnProxyHandler = void 0;
|
|
8419
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8420
|
-
var ColumnProxyHandler = class {
|
|
8421
|
-
constructor(table4) {
|
|
8422
|
-
this.table = table4;
|
|
8423
|
-
}
|
|
8424
|
-
get(columnObj, prop, receiver) {
|
|
8425
|
-
if (prop === "table") {
|
|
8426
|
-
return this.table;
|
|
8427
|
-
}
|
|
8428
|
-
return columnObj[prop];
|
|
8429
|
-
}
|
|
8430
|
-
};
|
|
8431
|
-
exports.ColumnProxyHandler = ColumnProxyHandler;
|
|
8432
|
-
var TableProxyHandler = class {
|
|
8433
|
-
constructor(alias) {
|
|
8434
|
-
this.alias = alias;
|
|
8435
|
-
}
|
|
8436
|
-
get(tableObj, prop, receiver) {
|
|
8437
|
-
if (prop === utils_1.tableName) {
|
|
8438
|
-
return this.alias;
|
|
8439
|
-
}
|
|
8440
|
-
if (prop === utils_1.tableColumns) {
|
|
8441
|
-
const proxiedColumns = {};
|
|
8442
|
-
Object.keys(tableObj[utils_1.tableColumns]).map((key) => {
|
|
8443
|
-
proxiedColumns[key] = new Proxy(tableObj[utils_1.tableColumns][key], new ColumnProxyHandler(new Proxy(tableObj, this)));
|
|
8444
|
-
});
|
|
8445
|
-
return proxiedColumns;
|
|
8446
|
-
}
|
|
8447
|
-
if (typeof prop !== "string") {
|
|
8448
|
-
return tableObj[prop];
|
|
8449
|
-
}
|
|
8450
|
-
return new Proxy(tableObj[prop], new ColumnProxyHandler(new Proxy(tableObj, this)));
|
|
8451
|
-
}
|
|
8452
|
-
};
|
|
8453
|
-
exports.TableProxyHandler = TableProxyHandler;
|
|
8454
|
-
}
|
|
8455
|
-
});
|
|
8456
|
-
|
|
8457
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/select.js
|
|
8458
|
-
var require_select = __commonJS({
|
|
8459
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/select.js"(exports) {
|
|
8460
|
-
"use strict";
|
|
8461
|
-
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
8462
|
-
function adopt(value) {
|
|
8463
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
8464
|
-
resolve(value);
|
|
8465
|
-
});
|
|
8466
|
-
}
|
|
8467
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
8468
|
-
function fulfilled(value) {
|
|
8469
|
-
try {
|
|
8470
|
-
step(generator.next(value));
|
|
8471
|
-
} catch (e) {
|
|
8472
|
-
reject(e);
|
|
8473
|
-
}
|
|
8474
|
-
}
|
|
8475
|
-
function rejected(value) {
|
|
8476
|
-
try {
|
|
8477
|
-
step(generator["throw"](value));
|
|
8478
|
-
} catch (e) {
|
|
8479
|
-
reject(e);
|
|
8480
|
-
}
|
|
8481
|
-
}
|
|
8482
|
-
function step(result) {
|
|
8483
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
8484
|
-
}
|
|
8485
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8486
|
-
});
|
|
8487
|
-
};
|
|
8488
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8489
|
-
exports.MySqlSelect = void 0;
|
|
8490
|
-
var sql_1 = require("drizzle-orm/sql");
|
|
8491
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8492
|
-
var table_1 = require_table();
|
|
8493
|
-
var proxies_1 = require_proxies();
|
|
8494
|
-
var MySqlSelect = class {
|
|
8495
|
-
constructor(table4, fields, session, dialect5, tableNamesMap) {
|
|
8496
|
-
this.table = table4;
|
|
8497
|
-
this.fields = fields;
|
|
8498
|
-
this.session = session;
|
|
8499
|
-
this.dialect = dialect5;
|
|
8500
|
-
this.tableNamesMap = tableNamesMap;
|
|
8501
|
-
this.aliases = {};
|
|
8502
|
-
this.leftJoin = this.createJoin("left");
|
|
8503
|
-
this.rightJoin = this.createJoin("right");
|
|
8504
|
-
this.innerJoin = this.createJoin("inner");
|
|
8505
|
-
this.fullJoin = this.createJoin("full");
|
|
8506
|
-
this.config = {
|
|
8507
|
-
table: table4,
|
|
8508
|
-
fields,
|
|
8509
|
-
joins: {},
|
|
8510
|
-
orderBy: []
|
|
8511
|
-
};
|
|
8512
|
-
this.joinsNotNullable = { [table4[utils_1.tableName]]: true };
|
|
8513
|
-
}
|
|
8514
|
-
createJoin(joinType) {
|
|
8515
|
-
const self2 = this;
|
|
8516
|
-
function join(aliasConfig, on, select) {
|
|
8517
|
-
let aliasName, joinedTable;
|
|
8518
|
-
if (aliasConfig instanceof table_1.MySqlTable) {
|
|
8519
|
-
aliasName = aliasConfig[utils_1.tableName];
|
|
8520
|
-
joinedTable = aliasConfig;
|
|
8521
|
-
} else {
|
|
8522
|
-
const config = Object.entries(aliasConfig)[0];
|
|
8523
|
-
if (!config) {
|
|
8524
|
-
throw new Error("Join alias is an empty object");
|
|
8525
|
-
}
|
|
8526
|
-
[aliasName, joinedTable] = config;
|
|
8527
|
-
}
|
|
8528
|
-
const joinName = self2.tableNamesMap[joinedTable[utils_1.tableName]];
|
|
8529
|
-
const tableAliasProxy = new Proxy(joinedTable, new proxies_1.TableProxyHandler(aliasName));
|
|
8530
|
-
if (!(aliasConfig instanceof table_1.MySqlTable)) {
|
|
8531
|
-
Object.assign(self2.aliases, { [aliasName]: tableAliasProxy });
|
|
8532
|
-
}
|
|
8533
|
-
const onExpression = typeof on === "function" ? on(self2.aliases) : on;
|
|
8534
|
-
const partialFields = typeof select === "function" ? select(tableAliasProxy) : select;
|
|
8535
|
-
self2.fields.push(...self2.dialect.orderSelectedFields(partialFields !== null && partialFields !== void 0 ? partialFields : tableAliasProxy[utils_1.tableColumns], joinName));
|
|
8536
|
-
self2.config.joins[joinName] = {
|
|
8537
|
-
on: onExpression,
|
|
8538
|
-
table: joinedTable,
|
|
8539
|
-
joinType,
|
|
8540
|
-
aliasTable: tableAliasProxy
|
|
8541
|
-
};
|
|
8542
|
-
switch (joinType) {
|
|
8543
|
-
case "left":
|
|
8544
|
-
self2.joinsNotNullable[joinName] = false;
|
|
8545
|
-
break;
|
|
8546
|
-
case "right":
|
|
8547
|
-
self2.joinsNotNullable = Object.fromEntries(Object.entries(self2.joinsNotNullable).map(([key]) => [key, false]));
|
|
8548
|
-
self2.joinsNotNullable[joinName] = true;
|
|
8549
|
-
break;
|
|
8550
|
-
case "inner":
|
|
8551
|
-
self2.joinsNotNullable = Object.fromEntries(Object.entries(self2.joinsNotNullable).map(([key]) => [key, true]));
|
|
8552
|
-
self2.joinsNotNullable[joinName] = true;
|
|
8553
|
-
break;
|
|
8554
|
-
case "full":
|
|
8555
|
-
self2.joinsNotNullable = Object.fromEntries(Object.entries(self2.joinsNotNullable).map(([key]) => [key, false]));
|
|
8556
|
-
self2.joinsNotNullable[joinName] = false;
|
|
8557
|
-
break;
|
|
8558
|
-
}
|
|
8559
|
-
return self2;
|
|
8560
|
-
}
|
|
8561
|
-
return join;
|
|
8562
|
-
}
|
|
8563
|
-
where(where) {
|
|
8564
|
-
if (where instanceof sql_1.SQL) {
|
|
8565
|
-
this.config.where = where;
|
|
8566
|
-
} else {
|
|
8567
|
-
this.config.where = where === null || where === void 0 ? void 0 : where(this.aliases);
|
|
8568
|
-
}
|
|
8569
|
-
return this;
|
|
8570
|
-
}
|
|
8571
|
-
orderBy(firstColumn, ...otherColumns) {
|
|
8572
|
-
let columns;
|
|
8573
|
-
if (firstColumn instanceof sql_1.SQL) {
|
|
8574
|
-
columns = [firstColumn, ...otherColumns];
|
|
8575
|
-
} else {
|
|
8576
|
-
const firstColumnResult = firstColumn(this.aliases);
|
|
8577
|
-
columns = [...Array.isArray(firstColumnResult) ? firstColumnResult : [firstColumnResult], ...otherColumns];
|
|
8578
|
-
}
|
|
8579
|
-
this.config.orderBy = columns;
|
|
8580
|
-
return this;
|
|
8581
|
-
}
|
|
8582
|
-
limit(limit) {
|
|
8583
|
-
this.config.limit = limit;
|
|
8584
|
-
return this;
|
|
8585
|
-
}
|
|
8586
|
-
offset(offset) {
|
|
8587
|
-
this.config.offset = offset;
|
|
8588
|
-
return this;
|
|
8589
|
-
}
|
|
8590
|
-
getSQL() {
|
|
8591
|
-
return this.dialect.buildSelectQuery(this.config);
|
|
8592
|
-
}
|
|
8593
|
-
getQuery() {
|
|
8594
|
-
const query = this.dialect.buildSelectQuery(this.config);
|
|
8595
|
-
return this.dialect.prepareSQL(query);
|
|
8596
|
-
}
|
|
8597
|
-
execute() {
|
|
8598
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8599
|
-
const query = this.dialect.buildSelectQuery(this.config);
|
|
8600
|
-
const { sql, params } = this.dialect.prepareSQL(query);
|
|
8601
|
-
const result = yield this.session.query(sql, params);
|
|
8602
|
-
return result[0].map((row) => (0, utils_1.mapResultRow)(this.fields, row, this.joinsNotNullable));
|
|
8603
|
-
});
|
|
8604
|
-
}
|
|
8605
|
-
};
|
|
8606
|
-
exports.MySqlSelect = MySqlSelect;
|
|
8607
|
-
}
|
|
8608
|
-
});
|
|
8609
|
-
|
|
8610
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/update.js
|
|
8611
|
-
var require_update = __commonJS({
|
|
8612
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/update.js"(exports) {
|
|
8613
|
-
"use strict";
|
|
8614
|
-
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
8615
|
-
function adopt(value) {
|
|
8616
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
8617
|
-
resolve(value);
|
|
8618
|
-
});
|
|
8619
|
-
}
|
|
8620
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
8621
|
-
function fulfilled(value) {
|
|
8622
|
-
try {
|
|
8623
|
-
step(generator.next(value));
|
|
8624
|
-
} catch (e) {
|
|
8625
|
-
reject(e);
|
|
8626
|
-
}
|
|
8627
|
-
}
|
|
8628
|
-
function rejected(value) {
|
|
8629
|
-
try {
|
|
8630
|
-
step(generator["throw"](value));
|
|
8631
|
-
} catch (e) {
|
|
8632
|
-
reject(e);
|
|
8633
|
-
}
|
|
8634
|
-
}
|
|
8635
|
-
function step(result) {
|
|
8636
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
8637
|
-
}
|
|
8638
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8639
|
-
});
|
|
8640
|
-
};
|
|
8641
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8642
|
-
exports.MySqlUpdate = void 0;
|
|
8643
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8644
|
-
var MySqlUpdate = class {
|
|
8645
|
-
constructor(table4, session, dialect5) {
|
|
8646
|
-
this.table = table4;
|
|
8647
|
-
this.session = session;
|
|
8648
|
-
this.dialect = dialect5;
|
|
8649
|
-
this.config = {
|
|
8650
|
-
set: {},
|
|
8651
|
-
table: table4
|
|
8652
|
-
};
|
|
8653
|
-
}
|
|
8654
|
-
set(values) {
|
|
8655
|
-
this.config.set = values;
|
|
8656
|
-
return this;
|
|
8657
|
-
}
|
|
8658
|
-
where(where) {
|
|
8659
|
-
this.config.where = where;
|
|
8660
|
-
return this;
|
|
8661
|
-
}
|
|
8662
|
-
returning(fields) {
|
|
8663
|
-
const orderedFields = this.dialect.orderSelectedFields(fields !== null && fields !== void 0 ? fields : this.config.table[utils_1.tableColumns], this.table[utils_1.tableName]);
|
|
8664
|
-
this.config.returning = orderedFields;
|
|
8665
|
-
return this;
|
|
8666
|
-
}
|
|
8667
|
-
getQuery() {
|
|
8668
|
-
const query = this.dialect.buildUpdateQuery(this.config);
|
|
8669
|
-
return this.dialect.prepareSQL(query);
|
|
8670
|
-
}
|
|
8671
|
-
execute() {
|
|
8672
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8673
|
-
const query = this.dialect.buildUpdateQuery(this.config);
|
|
8674
|
-
const { sql, params } = this.dialect.prepareSQL(query);
|
|
8675
|
-
const result = yield this.session.query(sql, params);
|
|
8676
|
-
const { returning } = this.config;
|
|
8677
|
-
if (returning) {
|
|
8678
|
-
return result[0].map((row) => (0, utils_1.mapResultRow)(returning, row));
|
|
8679
|
-
}
|
|
8680
|
-
return result;
|
|
8681
|
-
});
|
|
8682
|
-
}
|
|
8683
|
-
};
|
|
8684
|
-
exports.MySqlUpdate = MySqlUpdate;
|
|
8685
|
-
}
|
|
8686
|
-
});
|
|
8687
|
-
|
|
8688
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/insert.js
|
|
8689
|
-
var require_insert = __commonJS({
|
|
8690
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/insert.js"(exports) {
|
|
8691
|
-
"use strict";
|
|
8692
|
-
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
8693
|
-
function adopt(value) {
|
|
8694
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
8695
|
-
resolve(value);
|
|
8696
|
-
});
|
|
8697
|
-
}
|
|
8698
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
8699
|
-
function fulfilled(value) {
|
|
8700
|
-
try {
|
|
8701
|
-
step(generator.next(value));
|
|
8702
|
-
} catch (e) {
|
|
8703
|
-
reject(e);
|
|
8704
|
-
}
|
|
8705
|
-
}
|
|
8706
|
-
function rejected(value) {
|
|
8707
|
-
try {
|
|
8708
|
-
step(generator["throw"](value));
|
|
8709
|
-
} catch (e) {
|
|
8710
|
-
reject(e);
|
|
8711
|
-
}
|
|
8712
|
-
}
|
|
8713
|
-
function step(result) {
|
|
8714
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
8715
|
-
}
|
|
8716
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8717
|
-
});
|
|
8718
|
-
};
|
|
8719
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8720
|
-
exports.MySqlInsert = void 0;
|
|
8721
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8722
|
-
var MySqlInsert = class {
|
|
8723
|
-
constructor(table4, values, session, dialect5) {
|
|
8724
|
-
this.session = session;
|
|
8725
|
-
this.dialect = dialect5;
|
|
8726
|
-
this.config = {};
|
|
8727
|
-
this.config.table = table4;
|
|
8728
|
-
this.config.values = values;
|
|
8729
|
-
}
|
|
8730
|
-
returning(fields) {
|
|
8731
|
-
const fieldsToMap = fields !== null && fields !== void 0 ? fields : this.config.table[utils_1.tableColumns];
|
|
8732
|
-
this.config.returning = Object.entries(fieldsToMap).map(([name, column4]) => ({ name, column: column4, resultTableName: this.config.table[utils_1.tableName] }));
|
|
8733
|
-
return this;
|
|
8734
|
-
}
|
|
8735
|
-
getQuery() {
|
|
8736
|
-
const query = this.dialect.buildInsertQuery(this.config);
|
|
8737
|
-
return this.dialect.prepareSQL(query);
|
|
8738
|
-
}
|
|
8739
|
-
execute() {
|
|
8740
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8741
|
-
const query = this.dialect.buildInsertQuery(this.config);
|
|
8742
|
-
const { sql, params } = this.dialect.prepareSQL(query);
|
|
8743
|
-
const result = yield this.session.query(sql, params);
|
|
8744
|
-
const { returning } = this.config;
|
|
8745
|
-
if (returning) {
|
|
8746
|
-
return result[0].map((row) => (0, utils_1.mapResultRow)(returning, row));
|
|
8747
|
-
} else {
|
|
8748
|
-
return result;
|
|
8749
|
-
}
|
|
8750
|
-
});
|
|
8751
|
-
}
|
|
8752
|
-
};
|
|
8753
|
-
exports.MySqlInsert = MySqlInsert;
|
|
8754
|
-
}
|
|
8755
|
-
});
|
|
8756
|
-
|
|
8757
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/delete.js
|
|
8758
|
-
var require_delete = __commonJS({
|
|
8759
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/delete.js"(exports) {
|
|
8760
|
-
"use strict";
|
|
8761
|
-
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
8762
|
-
function adopt(value) {
|
|
8763
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
8764
|
-
resolve(value);
|
|
8765
|
-
});
|
|
8766
|
-
}
|
|
8767
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
8768
|
-
function fulfilled(value) {
|
|
8769
|
-
try {
|
|
8770
|
-
step(generator.next(value));
|
|
8771
|
-
} catch (e) {
|
|
8772
|
-
reject(e);
|
|
8773
|
-
}
|
|
8774
|
-
}
|
|
8775
|
-
function rejected(value) {
|
|
8776
|
-
try {
|
|
8777
|
-
step(generator["throw"](value));
|
|
8778
|
-
} catch (e) {
|
|
8779
|
-
reject(e);
|
|
8780
|
-
}
|
|
8781
|
-
}
|
|
8782
|
-
function step(result) {
|
|
8783
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
8784
|
-
}
|
|
8785
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8786
|
-
});
|
|
8787
|
-
};
|
|
8788
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8789
|
-
exports.MySqlDelete = void 0;
|
|
8790
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8791
|
-
var MySqlDelete = class {
|
|
8792
|
-
constructor(table4, session, dialect5) {
|
|
8793
|
-
this.table = table4;
|
|
8794
|
-
this.session = session;
|
|
8795
|
-
this.dialect = dialect5;
|
|
8796
|
-
this.config = { table: table4 };
|
|
8797
|
-
}
|
|
8798
|
-
where(where) {
|
|
8799
|
-
this.config.where = where;
|
|
8800
|
-
return this;
|
|
8801
|
-
}
|
|
8802
|
-
returning(fields) {
|
|
8803
|
-
const orderedFields = this.dialect.orderSelectedFields(fields !== null && fields !== void 0 ? fields : this.table[utils_1.tableColumns], this.table[utils_1.tableName]);
|
|
8804
|
-
this.config.returning = orderedFields;
|
|
8805
|
-
return this;
|
|
8806
|
-
}
|
|
8807
|
-
getQuery() {
|
|
8808
|
-
const query = this.dialect.buildDeleteQuery(this.config);
|
|
8809
|
-
return this.dialect.prepareSQL(query);
|
|
8810
|
-
}
|
|
8811
|
-
execute() {
|
|
8812
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8813
|
-
const query = this.dialect.buildDeleteQuery(this.config);
|
|
8814
|
-
const { sql, params } = this.dialect.prepareSQL(query);
|
|
8815
|
-
const result = yield this.session.query(sql, params);
|
|
8816
|
-
const { returning } = this.config;
|
|
8817
|
-
if (returning) {
|
|
8818
|
-
return result[0].map((row) => (0, utils_1.mapResultRow)(returning, row));
|
|
8819
|
-
}
|
|
8820
|
-
return result;
|
|
8821
|
-
});
|
|
8822
|
-
}
|
|
8823
|
-
};
|
|
8824
|
-
exports.MySqlDelete = MySqlDelete;
|
|
8825
|
-
}
|
|
8826
|
-
});
|
|
8827
|
-
|
|
8828
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/index.js
|
|
8829
|
-
var require_queries = __commonJS({
|
|
8830
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/queries/index.js"(exports) {
|
|
8831
|
-
"use strict";
|
|
8832
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
8833
|
-
if (k2 === void 0)
|
|
8834
|
-
k2 = k;
|
|
8835
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8836
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8837
|
-
desc = { enumerable: true, get: function() {
|
|
8838
|
-
return m[k];
|
|
8839
|
-
} };
|
|
8840
|
-
}
|
|
8841
|
-
Object.defineProperty(o, k2, desc);
|
|
8842
|
-
} : function(o, m, k, k2) {
|
|
8843
|
-
if (k2 === void 0)
|
|
8844
|
-
k2 = k;
|
|
8845
|
-
o[k2] = m[k];
|
|
8846
|
-
});
|
|
8847
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
8848
|
-
for (var p in m)
|
|
8849
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
8850
|
-
__createBinding(exports2, m, p);
|
|
8851
|
-
};
|
|
8852
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8853
|
-
__exportStar(require_select(), exports);
|
|
8854
|
-
__exportStar(require_update(), exports);
|
|
8855
|
-
__exportStar(require_insert(), exports);
|
|
8856
|
-
__exportStar(require_delete(), exports);
|
|
8857
|
-
}
|
|
8858
|
-
});
|
|
8859
|
-
|
|
8860
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/operations.js
|
|
8861
|
-
var require_operations = __commonJS({
|
|
8862
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/operations.js"(exports) {
|
|
8863
|
-
"use strict";
|
|
8864
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8865
|
-
exports.MySqlTableOperations = void 0;
|
|
8866
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8867
|
-
var queries_1 = require_queries();
|
|
8868
|
-
var MySqlTableOperations = class {
|
|
8869
|
-
constructor(table4, session, dialect5, tableNamesMap) {
|
|
8870
|
-
this.table = table4;
|
|
8871
|
-
this.session = session;
|
|
8872
|
-
this.dialect = dialect5;
|
|
8873
|
-
this.tableNamesMap = tableNamesMap;
|
|
8874
|
-
}
|
|
8875
|
-
select(fields) {
|
|
8876
|
-
const fieldsOrdered = this.dialect.orderSelectedFields(fields !== null && fields !== void 0 ? fields : this.table[utils_1.tableColumns], this.tableNamesMap[this.table[utils_1.tableName]]);
|
|
8877
|
-
return new queries_1.MySqlSelect(this.table, fieldsOrdered, this.session, this.dialect, this.tableNamesMap);
|
|
8878
|
-
}
|
|
8879
|
-
update() {
|
|
8880
|
-
return new queries_1.MySqlUpdate(this.table, this.session, this.dialect);
|
|
8881
|
-
}
|
|
8882
|
-
insert(values) {
|
|
8883
|
-
return new queries_1.MySqlInsert(this.table, Array.isArray(values) ? values : [values], this.session, this.dialect);
|
|
8884
|
-
}
|
|
8885
|
-
delete() {
|
|
8886
|
-
return new queries_1.MySqlDelete(this.table, this.session, this.dialect);
|
|
8887
|
-
}
|
|
8888
|
-
};
|
|
8889
|
-
exports.MySqlTableOperations = MySqlTableOperations;
|
|
8890
|
-
}
|
|
8891
|
-
});
|
|
8892
|
-
|
|
8893
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/connection.js
|
|
8894
|
-
var require_connection = __commonJS({
|
|
8895
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/connection.js"(exports) {
|
|
8896
|
-
"use strict";
|
|
8897
|
-
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
8898
|
-
function adopt(value) {
|
|
8899
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
8900
|
-
resolve(value);
|
|
8901
|
-
});
|
|
8902
|
-
}
|
|
8903
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
8904
|
-
function fulfilled(value) {
|
|
8905
|
-
try {
|
|
8906
|
-
step(generator.next(value));
|
|
8907
|
-
} catch (e) {
|
|
8908
|
-
reject(e);
|
|
8909
|
-
}
|
|
8910
|
-
}
|
|
8911
|
-
function rejected(value) {
|
|
8912
|
-
try {
|
|
8913
|
-
step(generator["throw"](value));
|
|
8914
|
-
} catch (e) {
|
|
8915
|
-
reject(e);
|
|
8916
|
-
}
|
|
8917
|
-
}
|
|
8918
|
-
function step(result) {
|
|
8919
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
8920
|
-
}
|
|
8921
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8922
|
-
});
|
|
8923
|
-
};
|
|
8924
|
-
var __asyncValues = exports && exports.__asyncValues || function(o) {
|
|
8925
|
-
if (!Symbol.asyncIterator)
|
|
8926
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
8927
|
-
var m = o[Symbol.asyncIterator], i;
|
|
8928
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
8929
|
-
return this;
|
|
8930
|
-
}, i);
|
|
8931
|
-
function verb(n) {
|
|
8932
|
-
i[n] = o[n] && function(v) {
|
|
8933
|
-
return new Promise(function(resolve, reject) {
|
|
8934
|
-
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
8935
|
-
});
|
|
8936
|
-
};
|
|
8937
|
-
}
|
|
8938
|
-
function settle(resolve, reject, d, v) {
|
|
8939
|
-
Promise.resolve(v).then(function(v2) {
|
|
8940
|
-
resolve({ value: v2, done: d });
|
|
8941
|
-
}, reject);
|
|
8942
|
-
}
|
|
8943
|
-
};
|
|
8944
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8945
|
-
exports.MySqlConnector = exports.MySqlDialect = exports.MySqlQueryResultDriver = exports.MySqlSessionDefault = void 0;
|
|
8946
|
-
var drizzle_orm_1 = require("drizzle-orm");
|
|
8947
|
-
var sql_1 = require("drizzle-orm/sql");
|
|
8948
|
-
var utils_1 = require("drizzle-orm/utils");
|
|
8949
|
-
var common_1 = require_common2();
|
|
8950
|
-
var operations_1 = require_operations();
|
|
8951
|
-
var MySqlSessionDefault = class {
|
|
8952
|
-
constructor(client) {
|
|
8953
|
-
this.client = client;
|
|
8954
|
-
}
|
|
8955
|
-
query(query, params) {
|
|
8956
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8957
|
-
const result = yield this.client.query({
|
|
8958
|
-
sql: query,
|
|
8959
|
-
values: params,
|
|
8960
|
-
rowsAsArray: true,
|
|
8961
|
-
typeCast: function(field, next) {
|
|
8962
|
-
if (field.type === "TIMESTAMP") {
|
|
8963
|
-
return field.string();
|
|
8964
|
-
}
|
|
8965
|
-
return next();
|
|
8966
|
-
}
|
|
8967
|
-
});
|
|
8968
|
-
return result;
|
|
8969
|
-
});
|
|
8970
|
-
}
|
|
8971
|
-
queryObjects(query, params) {
|
|
8972
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8973
|
-
return this.client.query(query, params);
|
|
8974
|
-
});
|
|
8975
|
-
}
|
|
8976
|
-
};
|
|
8977
|
-
exports.MySqlSessionDefault = MySqlSessionDefault;
|
|
8978
|
-
var MySqlQueryResultDriver = class {
|
|
8979
|
-
constructor(client) {
|
|
8980
|
-
this.client = client;
|
|
8981
|
-
}
|
|
8982
|
-
connect() {
|
|
8983
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8984
|
-
return new MySqlSessionDefault(this.client);
|
|
8985
|
-
});
|
|
8986
|
-
}
|
|
8987
|
-
};
|
|
8988
|
-
exports.MySqlQueryResultDriver = MySqlQueryResultDriver;
|
|
8989
|
-
var MySqlDialect = class {
|
|
8990
|
-
constructor(schema5) {
|
|
8991
|
-
this.schema = schema5;
|
|
8992
|
-
}
|
|
8993
|
-
migrate(migrations, session) {
|
|
8994
|
-
var migrations_1, migrations_1_1;
|
|
8995
|
-
var e_1, _a;
|
|
8996
|
-
var _b;
|
|
8997
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
8998
|
-
const migrationTableCreate = `CREATE TABLE IF NOT EXISTS "drizzle"."__drizzle_migrations" (
|
|
8999
|
-
id SERIAL PRIMARY KEY,
|
|
9000
|
-
hash text NOT NULL,
|
|
9001
|
-
created_at bigint
|
|
9002
|
-
)`.trim().replace(/\s{2,}/, " ").replace(/\n+/g, "").replace(/ +/g, " ");
|
|
9003
|
-
yield session.query('CREATE SCHEMA IF NOT EXISTS "drizzle"', []);
|
|
9004
|
-
yield session.query(migrationTableCreate, []);
|
|
9005
|
-
const dbMigrations = yield session.query(`SELECT id, hash, created_at FROM "drizzle"."__drizzle_migrations" ORDER BY created_at DESC LIMIT 1`, []);
|
|
9006
|
-
const lastDbMigration = (_b = dbMigrations[0][0]) !== null && _b !== void 0 ? _b : void 0;
|
|
9007
|
-
yield session.query("BEGIN;", []);
|
|
9008
|
-
try {
|
|
9009
|
-
try {
|
|
9010
|
-
for (migrations_1 = __asyncValues(migrations); migrations_1_1 = yield migrations_1.next(), !migrations_1_1.done; ) {
|
|
9011
|
-
const migration = migrations_1_1.value;
|
|
9012
|
-
if (!lastDbMigration || parseInt(lastDbMigration[2], 10) < migration.folderMillis) {
|
|
9013
|
-
yield session.query(migration.sql, []);
|
|
9014
|
-
yield session.query(`INSERT INTO "drizzle"."__drizzle_migrations" ("hash", "created_at") VALUES('${migration.hash}', ${migration.folderMillis})`, []);
|
|
9015
|
-
}
|
|
9016
|
-
}
|
|
9017
|
-
} catch (e_1_1) {
|
|
9018
|
-
e_1 = { error: e_1_1 };
|
|
9019
|
-
} finally {
|
|
9020
|
-
try {
|
|
9021
|
-
if (migrations_1_1 && !migrations_1_1.done && (_a = migrations_1.return))
|
|
9022
|
-
yield _a.call(migrations_1);
|
|
9023
|
-
} finally {
|
|
9024
|
-
if (e_1)
|
|
9025
|
-
throw e_1.error;
|
|
9026
|
-
}
|
|
9027
|
-
}
|
|
9028
|
-
yield session.query("COMMIT;", []);
|
|
9029
|
-
} catch (e) {
|
|
9030
|
-
yield session.query("ROLLBACK;", []);
|
|
9031
|
-
throw e;
|
|
9032
|
-
}
|
|
9033
|
-
});
|
|
9034
|
-
}
|
|
9035
|
-
buildTableNamesMap() {
|
|
9036
|
-
return Object.entries(this.schema).reduce((acc, [tName, table4]) => {
|
|
9037
|
-
acc[table4[utils_1.tableName]] = tName;
|
|
9038
|
-
return acc;
|
|
9039
|
-
}, {});
|
|
9040
|
-
}
|
|
9041
|
-
createDB(session) {
|
|
9042
|
-
return this.createMySqlDB(session);
|
|
9043
|
-
}
|
|
9044
|
-
createMySqlDB(session) {
|
|
9045
|
-
return Object.assign(Object.fromEntries(Object.entries(this.schema).map(([tableName, table4]) => {
|
|
9046
|
-
return [
|
|
9047
|
-
tableName,
|
|
9048
|
-
new operations_1.MySqlTableOperations(table4, session, this, this.buildTableNamesMap())
|
|
9049
|
-
];
|
|
9050
|
-
})), {
|
|
9051
|
-
execute: (query) => {
|
|
9052
|
-
const preparedQuery = query instanceof sql_1.SQL ? this.prepareSQL(query) : query;
|
|
9053
|
-
return session.queryObjects(preparedQuery.sql, preparedQuery.params);
|
|
9054
|
-
}
|
|
9055
|
-
});
|
|
9056
|
-
}
|
|
9057
|
-
escapeName(name) {
|
|
9058
|
-
return `\`${name}\``;
|
|
9059
|
-
}
|
|
9060
|
-
escapeParam(num) {
|
|
9061
|
-
return `?`;
|
|
9062
|
-
}
|
|
9063
|
-
buildDeleteQuery({ table: table4, where, returning }) {
|
|
9064
|
-
const returningSql = returning ? (0, drizzle_orm_1.sql)` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
|
|
9065
|
-
const whereSql = where ? (0, drizzle_orm_1.sql)` where ${where}` : void 0;
|
|
9066
|
-
return (0, drizzle_orm_1.sql)`delete from ${table4}${whereSql}${returningSql}`;
|
|
9067
|
-
}
|
|
9068
|
-
buildUpdateSet(table4, set) {
|
|
9069
|
-
const setEntries = Object.entries(set);
|
|
9070
|
-
const setSize = setEntries.length;
|
|
9071
|
-
return drizzle_orm_1.sql.fromList(setEntries.map(([colName, value], i) => {
|
|
9072
|
-
const col = table4[utils_1.tableColumns][colName];
|
|
9073
|
-
const mappedValue = value instanceof sql_1.SQL || value === null ? value : (0, drizzle_orm_1.param)(value, col);
|
|
9074
|
-
const res = (0, drizzle_orm_1.sql)`${new sql_1.Name(col.name)} = ${mappedValue}`;
|
|
9075
|
-
if (i < setSize - 1) {
|
|
9076
|
-
return [res, drizzle_orm_1.sql.raw(", ")];
|
|
9077
|
-
}
|
|
9078
|
-
return [res];
|
|
9079
|
-
}).flat(1));
|
|
9080
|
-
}
|
|
9081
|
-
orderSelectedFields(fields, resultTableName) {
|
|
9082
|
-
return Object.entries(fields).map(([name, column4]) => ({
|
|
9083
|
-
name,
|
|
9084
|
-
resultTableName,
|
|
9085
|
-
column: column4
|
|
9086
|
-
}));
|
|
9087
|
-
}
|
|
9088
|
-
buildUpdateQuery({ table: table4, set, where, returning }) {
|
|
9089
|
-
const setSql = this.buildUpdateSet(table4, set);
|
|
9090
|
-
const returningSql = returning ? (0, drizzle_orm_1.sql)` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
|
|
9091
|
-
const whereSql = where ? (0, drizzle_orm_1.sql)` where ${where}` : void 0;
|
|
9092
|
-
return (0, drizzle_orm_1.sql)`update ${table4} set ${setSql}${whereSql}${returningSql}`;
|
|
9093
|
-
}
|
|
9094
|
-
buildSelection(columns, { isSingleTable = false } = {}) {
|
|
9095
|
-
const columnsLen = columns.length;
|
|
9096
|
-
const chunks = columns.map(({ column: column4 }, i) => {
|
|
9097
|
-
const chunk = [];
|
|
9098
|
-
if (column4 instanceof sql_1.SQLResponse) {
|
|
9099
|
-
if (isSingleTable) {
|
|
9100
|
-
chunk.push(new sql_1.SQL(column4.sql.queryChunks.map((c) => {
|
|
9101
|
-
if (c instanceof common_1.MySqlColumn) {
|
|
9102
|
-
return new sql_1.Name(c.name);
|
|
9103
|
-
}
|
|
9104
|
-
return c;
|
|
9105
|
-
})));
|
|
9106
|
-
} else {
|
|
9107
|
-
chunk.push(column4.sql);
|
|
9108
|
-
}
|
|
9109
|
-
} else if (column4 instanceof drizzle_orm_1.Column) {
|
|
9110
|
-
if (isSingleTable) {
|
|
9111
|
-
chunk.push(new sql_1.Name(column4.name));
|
|
9112
|
-
} else {
|
|
9113
|
-
chunk.push(column4);
|
|
9114
|
-
}
|
|
9115
|
-
}
|
|
9116
|
-
if (i < columnsLen - 1) {
|
|
9117
|
-
chunk.push((0, drizzle_orm_1.sql)`, `);
|
|
9118
|
-
}
|
|
9119
|
-
return chunk;
|
|
9120
|
-
}).flat(1);
|
|
9121
|
-
return drizzle_orm_1.sql.fromList(chunks);
|
|
9122
|
-
}
|
|
9123
|
-
buildSelectQuery({ fields, where, table: table4, joins, orderBy, limit, offset }) {
|
|
9124
|
-
const joinKeys = Object.keys(joins);
|
|
9125
|
-
const fieldsSql = this.buildSelection(fields, { isSingleTable: joinKeys.length === 0 });
|
|
9126
|
-
const joinsArray = [];
|
|
9127
|
-
joinKeys.forEach((tableAlias, index4) => {
|
|
9128
|
-
if (index4 === 0) {
|
|
9129
|
-
joinsArray.push((0, drizzle_orm_1.sql)` `);
|
|
9130
|
-
}
|
|
9131
|
-
const joinMeta = joins[tableAlias];
|
|
9132
|
-
const alias = joinMeta.aliasTable[utils_1.tableName] === joinMeta.table[utils_1.tableName] ? void 0 : joinMeta.aliasTable;
|
|
9133
|
-
joinsArray.push((0, drizzle_orm_1.sql)`${drizzle_orm_1.sql.raw(joinMeta.joinType)} join ${joinMeta.table} ${alias} on ${joinMeta.on}`);
|
|
9134
|
-
if (index4 < joinKeys.length - 1) {
|
|
9135
|
-
joinsArray.push((0, drizzle_orm_1.sql)` `);
|
|
9136
|
-
}
|
|
9137
|
-
});
|
|
9138
|
-
const joinsSql = drizzle_orm_1.sql.fromList(joinsArray);
|
|
9139
|
-
const whereSql = where ? (0, drizzle_orm_1.sql)` where ${where}` : void 0;
|
|
9140
|
-
const orderByList = [];
|
|
9141
|
-
orderBy.forEach((orderByValue, index4) => {
|
|
9142
|
-
orderByList.push(orderByValue);
|
|
9143
|
-
if (index4 < orderBy.length - 1) {
|
|
9144
|
-
orderByList.push((0, drizzle_orm_1.sql)`, `);
|
|
9145
|
-
}
|
|
9146
|
-
});
|
|
9147
|
-
const orderBySql = orderByList.length > 0 ? (0, drizzle_orm_1.sql)` order by ${drizzle_orm_1.sql.fromList(orderByList)}` : void 0;
|
|
9148
|
-
const limitSql = limit ? (0, drizzle_orm_1.sql)` limit ${limit}` : void 0;
|
|
9149
|
-
const offsetSql = offset ? (0, drizzle_orm_1.sql)` offset ${offset}` : void 0;
|
|
9150
|
-
return (0, drizzle_orm_1.sql)`select ${fieldsSql} from ${table4}${joinsSql}${whereSql}${orderBySql}${limitSql}${offsetSql}`;
|
|
9151
|
-
}
|
|
9152
|
-
buildInsertQuery({ table: table4, values, onConflict, returning }) {
|
|
9153
|
-
const valuesSqlList = [];
|
|
9154
|
-
const columns = table4[utils_1.tableColumns];
|
|
9155
|
-
const columnKeys = Object.keys(columns);
|
|
9156
|
-
const insertOrder = Object.values(columns).map((column4) => new sql_1.Name(column4.name));
|
|
9157
|
-
values.forEach((value, valueIndex) => {
|
|
9158
|
-
const valueList = [];
|
|
9159
|
-
columnKeys.forEach((colKey) => {
|
|
9160
|
-
const colValue = value[colKey];
|
|
9161
|
-
const column4 = columns[colKey];
|
|
9162
|
-
if (typeof colValue === "undefined") {
|
|
9163
|
-
valueList.push((0, drizzle_orm_1.sql)`default`);
|
|
9164
|
-
} else if (colValue instanceof sql_1.SQL || colValue === null) {
|
|
9165
|
-
valueList.push(colValue);
|
|
9166
|
-
} else {
|
|
9167
|
-
valueList.push((0, drizzle_orm_1.param)(colValue, column4));
|
|
9168
|
-
}
|
|
9169
|
-
});
|
|
9170
|
-
valuesSqlList.push(valueList);
|
|
9171
|
-
if (valueIndex < values.length - 1) {
|
|
9172
|
-
valuesSqlList.push((0, drizzle_orm_1.sql)`, `);
|
|
9173
|
-
}
|
|
9174
|
-
});
|
|
9175
|
-
const valuesSql = drizzle_orm_1.sql.fromList(valuesSqlList);
|
|
9176
|
-
const returningSql = returning ? (0, drizzle_orm_1.sql)` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
|
|
9177
|
-
const onConflictSql = onConflict ? (0, drizzle_orm_1.sql)` on conflict ${onConflict}` : void 0;
|
|
9178
|
-
return (0, drizzle_orm_1.sql)`insert into ${table4} ${insertOrder} values ${valuesSql}${onConflictSql}${returningSql}`;
|
|
9179
|
-
}
|
|
9180
|
-
prepareSQL(sql) {
|
|
9181
|
-
return sql.toQuery({
|
|
9182
|
-
escapeName: this.escapeName,
|
|
9183
|
-
escapeParam: this.escapeParam
|
|
9184
|
-
});
|
|
9185
|
-
}
|
|
9186
|
-
};
|
|
9187
|
-
exports.MySqlDialect = MySqlDialect;
|
|
9188
|
-
var MySqlConnector = class {
|
|
9189
|
-
constructor(client, dbSchema) {
|
|
9190
|
-
this.dialect = new MySqlDialect(dbSchema);
|
|
9191
|
-
this.driver = new MySqlQueryResultDriver(client);
|
|
9192
|
-
}
|
|
9193
|
-
};
|
|
9194
|
-
exports.MySqlConnector = MySqlConnector;
|
|
9195
|
-
}
|
|
9196
|
-
});
|
|
9197
|
-
|
|
9198
|
-
// node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/index.js
|
|
9199
|
-
var require_drizzle_orm_mysql = __commonJS({
|
|
9200
|
-
"node_modules/.pnpm/drizzle-orm-mysql@0.12.0-beta.14_drizzle-orm@0.12.0-beta.17/node_modules/drizzle-orm-mysql/index.js"(exports) {
|
|
9201
|
-
"use strict";
|
|
9202
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
9203
|
-
if (k2 === void 0)
|
|
9204
|
-
k2 = k;
|
|
9205
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9206
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9207
|
-
desc = { enumerable: true, get: function() {
|
|
9208
|
-
return m[k];
|
|
9209
|
-
} };
|
|
9210
|
-
}
|
|
9211
|
-
Object.defineProperty(o, k2, desc);
|
|
9212
|
-
} : function(o, m, k, k2) {
|
|
9213
|
-
if (k2 === void 0)
|
|
9214
|
-
k2 = k;
|
|
9215
|
-
o[k2] = m[k];
|
|
9216
|
-
});
|
|
9217
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
9218
|
-
for (var p in m)
|
|
9219
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
9220
|
-
__createBinding(exports2, m, p);
|
|
9221
|
-
};
|
|
9222
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9223
|
-
__exportStar(require_checks(), exports);
|
|
9224
|
-
__exportStar(require_columns(), exports);
|
|
9225
|
-
__exportStar(require_connection(), exports);
|
|
9226
|
-
__exportStar(require_foreign_keys(), exports);
|
|
9227
|
-
__exportStar(require_indexes(), exports);
|
|
9228
|
-
__exportStar(require_operations(), exports);
|
|
9229
|
-
__exportStar(require_table(), exports);
|
|
9230
|
-
}
|
|
9231
|
-
});
|
|
9232
|
-
|
|
9233
|
-
// node_modules/.pnpm/heap@0.2.7/node_modules/heap/lib/heap.js
|
|
9234
|
-
var require_heap = __commonJS({
|
|
9235
|
-
"node_modules/.pnpm/heap@0.2.7/node_modules/heap/lib/heap.js"(exports, module2) {
|
|
9236
|
-
(function() {
|
|
9237
|
-
var Heap, defaultCmp, floor, heapify, heappop, heappush, heappushpop, heapreplace, insort, min, nlargest, nsmallest, updateItem, _siftdown, _siftup;
|
|
9238
|
-
floor = Math.floor, min = Math.min;
|
|
9239
|
-
defaultCmp = function(x, y) {
|
|
9240
|
-
if (x < y) {
|
|
9241
|
-
return -1;
|
|
9242
|
-
}
|
|
9243
|
-
if (x > y) {
|
|
9244
|
-
return 1;
|
|
9245
|
-
}
|
|
9246
|
-
return 0;
|
|
9247
|
-
};
|
|
9248
|
-
insort = function(a, x, lo, hi, cmp) {
|
|
9249
|
-
var mid;
|
|
9250
|
-
if (lo == null) {
|
|
9251
|
-
lo = 0;
|
|
7624
|
+
return 0;
|
|
7625
|
+
};
|
|
7626
|
+
insort = function(a, x, lo, hi, cmp) {
|
|
7627
|
+
var mid;
|
|
7628
|
+
if (lo == null) {
|
|
7629
|
+
lo = 0;
|
|
9252
7630
|
}
|
|
9253
7631
|
if (cmp == null) {
|
|
9254
7632
|
cmp = defaultCmp;
|
|
@@ -14229,7 +12607,7 @@ var require_get_stripped_length = __commonJS({
|
|
|
14229
12607
|
});
|
|
14230
12608
|
|
|
14231
12609
|
// node_modules/.pnpm/cli-color@2.0.3/node_modules/cli-color/columns.js
|
|
14232
|
-
var
|
|
12610
|
+
var require_columns = __commonJS({
|
|
14233
12611
|
"node_modules/.pnpm/cli-color@2.0.3/node_modules/cli-color/columns.js"(exports, module2) {
|
|
14234
12612
|
"use strict";
|
|
14235
12613
|
var generate = require_generate();
|
|
@@ -14938,7 +13316,7 @@ var require_cli_color = __commonJS({
|
|
|
14938
13316
|
erase: d(require_erase()),
|
|
14939
13317
|
move: d(require_move()),
|
|
14940
13318
|
beep: d(require_beep()),
|
|
14941
|
-
columns: d(
|
|
13319
|
+
columns: d(require_columns()),
|
|
14942
13320
|
strip: d(require_strip()),
|
|
14943
13321
|
getStrippedLength: d(require_get_stripped_length()),
|
|
14944
13322
|
slice: d(require_slice()),
|
|
@@ -15421,7 +13799,7 @@ var require_src2 = __commonJS({
|
|
|
15421
13799
|
});
|
|
15422
13800
|
|
|
15423
13801
|
// node_modules/.pnpm/hanji@0.0.3/node_modules/hanji/utils.js
|
|
15424
|
-
var
|
|
13802
|
+
var require_utils = __commonJS({
|
|
15425
13803
|
"node_modules/.pnpm/hanji@0.0.3/node_modules/hanji/utils.js"(exports) {
|
|
15426
13804
|
"use strict";
|
|
15427
13805
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -15609,7 +13987,7 @@ var require_hanji = __commonJS({
|
|
|
15609
13987
|
exports.onTerminate = exports.render = exports.Terminal = exports.deferred = exports.SelectState = exports.Prompt = void 0;
|
|
15610
13988
|
var readline_1 = require_readline();
|
|
15611
13989
|
var sisteransi_1 = require_src2();
|
|
15612
|
-
var utils_1 =
|
|
13990
|
+
var utils_1 = require_utils();
|
|
15613
13991
|
var lodash_throttle_1 = __importDefault(require_lodash());
|
|
15614
13992
|
var Prompt2 = class {
|
|
15615
13993
|
constructor() {
|
|
@@ -18600,68 +16978,14 @@ var optionalType = ZodOptional.create;
|
|
|
18600
16978
|
var nullableType = ZodNullable.create;
|
|
18601
16979
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
18602
16980
|
|
|
18603
|
-
// src/
|
|
18604
|
-
var indexV2 = objectType({
|
|
18605
|
-
name: stringType(),
|
|
18606
|
-
columns: recordType(
|
|
18607
|
-
stringType(),
|
|
18608
|
-
objectType({
|
|
18609
|
-
name: stringType()
|
|
18610
|
-
})
|
|
18611
|
-
),
|
|
18612
|
-
isUnique: booleanType()
|
|
18613
|
-
}).strict();
|
|
18614
|
-
var columnV2 = objectType({
|
|
18615
|
-
name: stringType(),
|
|
18616
|
-
type: stringType(),
|
|
18617
|
-
primaryKey: booleanType(),
|
|
18618
|
-
notNull: booleanType(),
|
|
18619
|
-
default: anyType().optional(),
|
|
18620
|
-
references: stringType().optional()
|
|
18621
|
-
}).strict();
|
|
18622
|
-
var tableV2 = objectType({
|
|
18623
|
-
name: stringType(),
|
|
18624
|
-
columns: recordType(stringType(), columnV2),
|
|
18625
|
-
indexes: recordType(stringType(), indexV2)
|
|
18626
|
-
}).strict();
|
|
18627
|
-
var enumSchema = objectType({
|
|
18628
|
-
name: stringType(),
|
|
18629
|
-
values: recordType(stringType(), stringType())
|
|
18630
|
-
}).strict();
|
|
18631
|
-
var schemaV2 = objectType({
|
|
18632
|
-
version: literalType("2"),
|
|
18633
|
-
tables: recordType(stringType(), tableV2),
|
|
18634
|
-
enums: recordType(stringType(), enumSchema)
|
|
18635
|
-
}).strict();
|
|
18636
|
-
var references = objectType({
|
|
18637
|
-
foreignKeyName: stringType(),
|
|
18638
|
-
table: stringType(),
|
|
18639
|
-
column: stringType(),
|
|
18640
|
-
onDelete: stringType().optional(),
|
|
18641
|
-
onUpdate: stringType().optional()
|
|
18642
|
-
}).strict();
|
|
18643
|
-
var columnV1 = objectType({
|
|
18644
|
-
name: stringType(),
|
|
18645
|
-
type: stringType(),
|
|
18646
|
-
primaryKey: booleanType(),
|
|
18647
|
-
notNull: booleanType(),
|
|
18648
|
-
default: anyType().optional(),
|
|
18649
|
-
references: references.optional()
|
|
18650
|
-
}).strict();
|
|
18651
|
-
var tableV1 = objectType({
|
|
18652
|
-
name: stringType(),
|
|
18653
|
-
columns: recordType(stringType(), columnV1),
|
|
18654
|
-
indexes: recordType(stringType(), indexV2)
|
|
18655
|
-
}).strict();
|
|
18656
|
-
var schemaV1 = objectType({
|
|
18657
|
-
version: literalType("1"),
|
|
18658
|
-
tables: recordType(stringType(), tableV1),
|
|
18659
|
-
enums: recordType(stringType(), enumSchema)
|
|
18660
|
-
}).strict();
|
|
16981
|
+
// src/serializer/mysqlSchema.ts
|
|
18661
16982
|
var index = objectType({
|
|
18662
16983
|
name: stringType(),
|
|
18663
16984
|
columns: stringType().array(),
|
|
18664
|
-
isUnique: booleanType()
|
|
16985
|
+
isUnique: booleanType(),
|
|
16986
|
+
using: enumType(["btree", "hash"]).optional(),
|
|
16987
|
+
algorithm: enumType(["default", "inplace", "copy"]).optional(),
|
|
16988
|
+
lock: enumType(["default", "none", "shared", "exclusive"]).optional()
|
|
18665
16989
|
}).strict();
|
|
18666
16990
|
var fk = objectType({
|
|
18667
16991
|
name: stringType(),
|
|
@@ -18677,6 +17001,7 @@ var column = objectType({
|
|
|
18677
17001
|
type: stringType(),
|
|
18678
17002
|
primaryKey: booleanType(),
|
|
18679
17003
|
notNull: booleanType(),
|
|
17004
|
+
autoincrement: booleanType().optional(),
|
|
18680
17005
|
default: anyType().optional()
|
|
18681
17006
|
}).strict();
|
|
18682
17007
|
var table = objectType({
|
|
@@ -18685,7 +17010,7 @@ var table = objectType({
|
|
|
18685
17010
|
indexes: recordType(stringType(), index),
|
|
18686
17011
|
foreignKeys: recordType(stringType(), fk)
|
|
18687
17012
|
}).strict();
|
|
18688
|
-
var dialect = enumType(["
|
|
17013
|
+
var dialect = enumType(["mysql"]);
|
|
18689
17014
|
var schemaHash = objectType({
|
|
18690
17015
|
id: stringType(),
|
|
18691
17016
|
prevId: stringType()
|
|
@@ -18694,7 +17019,7 @@ var schemaInternal = objectType({
|
|
|
18694
17019
|
version: literalType("3"),
|
|
18695
17020
|
dialect,
|
|
18696
17021
|
tables: recordType(stringType(), table),
|
|
18697
|
-
enums:
|
|
17022
|
+
enums: objectType({})
|
|
18698
17023
|
}).strict();
|
|
18699
17024
|
var schema = schemaInternal.merge(schemaHash);
|
|
18700
17025
|
var tableSquashed = objectType({
|
|
@@ -18707,19 +17032,23 @@ var schemaSquashed = objectType({
|
|
|
18707
17032
|
version: literalType("3"),
|
|
18708
17033
|
dialect,
|
|
18709
17034
|
tables: recordType(stringType(), tableSquashed),
|
|
18710
|
-
enums:
|
|
17035
|
+
enums: anyType()
|
|
18711
17036
|
}).strict();
|
|
18712
|
-
var
|
|
17037
|
+
var MySqlSquasher = {
|
|
18713
17038
|
squashIdx: (idx) => {
|
|
17039
|
+
var _a, _b, _c;
|
|
18714
17040
|
index.parse(idx);
|
|
18715
|
-
return `${idx.name};${idx.columns.join(",")};${idx.isUnique}`;
|
|
17041
|
+
return `${idx.name};${idx.columns.join(",")};${idx.isUnique};${(_a = idx.using) != null ? _a : ""};${(_b = idx.algorithm) != null ? _b : ""};${(_c = idx.lock) != null ? _c : ""}`;
|
|
18716
17042
|
},
|
|
18717
17043
|
unsquashIdx: (input) => {
|
|
18718
|
-
const [name, columnsString, isUnique] = input.split(";");
|
|
17044
|
+
const [name, columnsString, isUnique, using, algorithm, lock] = input.split(";");
|
|
18719
17045
|
const result = index.parse({
|
|
18720
17046
|
name,
|
|
18721
17047
|
columns: columnsString.split(","),
|
|
18722
|
-
isUnique: isUnique === "true"
|
|
17048
|
+
isUnique: isUnique === "true",
|
|
17049
|
+
using,
|
|
17050
|
+
algorithm,
|
|
17051
|
+
lock
|
|
18723
17052
|
});
|
|
18724
17053
|
return result;
|
|
18725
17054
|
},
|
|
@@ -18749,271 +17078,169 @@ var PgSquasher = {
|
|
|
18749
17078
|
return result;
|
|
18750
17079
|
}
|
|
18751
17080
|
};
|
|
18752
|
-
var
|
|
18753
|
-
|
|
18754
|
-
// src/migrationPreparator.ts
|
|
18755
|
-
var import_crypto = require("crypto");
|
|
18756
|
-
|
|
18757
|
-
// src/serializer/index.ts
|
|
18758
|
-
var import_fs = __toESM(require("fs"));
|
|
18759
|
-
var import_node = __toESM(require_node2());
|
|
18760
|
-
|
|
18761
|
-
// src/serializer/pgSerializer.ts
|
|
18762
|
-
var import_utils = require("drizzle-orm-pg/utils");
|
|
18763
|
-
var import_sql = require("drizzle-orm/sql");
|
|
18764
|
-
var import_table = require("drizzle-orm/table");
|
|
18765
|
-
var generatePgSnapshot = (tables, enums) => {
|
|
18766
|
-
const result = {};
|
|
18767
|
-
for (const table4 of tables) {
|
|
18768
|
-
const tableName = (0, import_table.getTableName)(table4);
|
|
18769
|
-
const columnsObject = {};
|
|
18770
|
-
const indexesObject = {};
|
|
18771
|
-
const foreignKeysObject = {};
|
|
18772
|
-
(0, import_utils.getTableColumns)(table4).forEach((column4) => {
|
|
18773
|
-
const notNull = column4.notNull;
|
|
18774
|
-
const primaryKey = column4.primary;
|
|
18775
|
-
const columnToSet = {
|
|
18776
|
-
name: column4.name,
|
|
18777
|
-
type: column4.getSQLType(),
|
|
18778
|
-
primaryKey,
|
|
18779
|
-
notNull
|
|
18780
|
-
};
|
|
18781
|
-
if (column4.default !== void 0) {
|
|
18782
|
-
if (column4.default instanceof import_sql.SQL) {
|
|
18783
|
-
columnToSet.default = column4.default.queryChunks.map((it) => {
|
|
18784
|
-
if (typeof it === "string") {
|
|
18785
|
-
return `${it}`;
|
|
18786
|
-
}
|
|
18787
|
-
throw new Error("Only strings are allowed in .default()");
|
|
18788
|
-
}).join();
|
|
18789
|
-
} else {
|
|
18790
|
-
columnToSet.default = typeof column4.default === "string" ? `'${column4.default}'` : column4.default;
|
|
18791
|
-
}
|
|
18792
|
-
}
|
|
18793
|
-
columnsObject[column4.name] = columnToSet;
|
|
18794
|
-
});
|
|
18795
|
-
const foreignKeys = (0, import_utils.getTableForeignKeys)(table4).map((fk4) => {
|
|
18796
|
-
const name = fk4.getName();
|
|
18797
|
-
const tableFrom = tableName;
|
|
18798
|
-
const onDelete = fk4.onDelete;
|
|
18799
|
-
const onUpdate = fk4.onUpdate;
|
|
18800
|
-
const reference = fk4.reference();
|
|
18801
|
-
const tableTo = (0, import_table.getTableName)(reference.foreignTable);
|
|
18802
|
-
const columnsFrom = reference.columns.map((it) => it.name);
|
|
18803
|
-
const columnsTo = reference.foreignColumns.map((it) => it.name);
|
|
18804
|
-
return {
|
|
18805
|
-
name,
|
|
18806
|
-
tableFrom,
|
|
18807
|
-
tableTo,
|
|
18808
|
-
columnsFrom,
|
|
18809
|
-
columnsTo,
|
|
18810
|
-
onDelete,
|
|
18811
|
-
onUpdate
|
|
18812
|
-
};
|
|
18813
|
-
});
|
|
18814
|
-
foreignKeys.forEach((it) => {
|
|
18815
|
-
foreignKeysObject[it.name] = it;
|
|
18816
|
-
});
|
|
18817
|
-
(0, import_utils.getTableIndexes)(table4).forEach((value) => {
|
|
18818
|
-
var _a;
|
|
18819
|
-
const columns = value.columns;
|
|
18820
|
-
const name = value.name;
|
|
18821
|
-
let indexColumns = columns.map((it) => it.name);
|
|
18822
|
-
indexesObject[name] = {
|
|
18823
|
-
name,
|
|
18824
|
-
columns: indexColumns,
|
|
18825
|
-
isUnique: (_a = value.config.unique) != null ? _a : false
|
|
18826
|
-
};
|
|
18827
|
-
});
|
|
18828
|
-
result[tableName] = {
|
|
18829
|
-
name: tableName,
|
|
18830
|
-
columns: columnsObject,
|
|
18831
|
-
indexes: indexesObject,
|
|
18832
|
-
foreignKeys: foreignKeysObject
|
|
18833
|
-
};
|
|
18834
|
-
}
|
|
18835
|
-
const enumsToReturn = enums.reduce((map, obj) => {
|
|
18836
|
-
const key = obj.enumName;
|
|
18837
|
-
const newValues = obj.enumValues.reduce((mapped, value) => {
|
|
18838
|
-
mapped[value] = value;
|
|
18839
|
-
return mapped;
|
|
18840
|
-
}, {});
|
|
18841
|
-
map[key] = { name: obj.enumName, values: newValues };
|
|
18842
|
-
return map;
|
|
18843
|
-
}, {});
|
|
18844
|
-
return { version: "3", dialect: "pg", tables: result, enums: enumsToReturn };
|
|
18845
|
-
};
|
|
18846
|
-
|
|
18847
|
-
// src/serializer/imports.ts
|
|
18848
|
-
var import_drizzle_orm_mysql = __toESM(require_drizzle_orm_mysql());
|
|
18849
|
-
var import_drizzle_orm_pg = require("drizzle-orm-pg");
|
|
18850
|
-
var import_drizzle_orm_sqlite = require("drizzle-orm-sqlite");
|
|
18851
|
-
var prepareFromImports = (imports) => {
|
|
18852
|
-
const tables = [];
|
|
18853
|
-
const enums = [];
|
|
18854
|
-
imports.forEach((it) => {
|
|
18855
|
-
const i0 = require(it);
|
|
18856
|
-
const i0values = Object.values(i0);
|
|
18857
|
-
i0values.forEach((t) => {
|
|
18858
|
-
if ((0, import_drizzle_orm_pg.isPgEnum)(t)) {
|
|
18859
|
-
enums.push(t);
|
|
18860
|
-
return;
|
|
18861
|
-
}
|
|
18862
|
-
if (t instanceof import_drizzle_orm_pg.PgTable) {
|
|
18863
|
-
tables.push(
|
|
18864
|
-
t
|
|
18865
|
-
);
|
|
18866
|
-
}
|
|
18867
|
-
});
|
|
18868
|
-
});
|
|
18869
|
-
return { tables, enums };
|
|
18870
|
-
};
|
|
18871
|
-
var prepareFromSqliteImports = (imports) => {
|
|
18872
|
-
const tables = [];
|
|
18873
|
-
const enums = [];
|
|
18874
|
-
imports.forEach((it) => {
|
|
18875
|
-
const i0 = require(it);
|
|
18876
|
-
const i0values = Object.values(i0);
|
|
18877
|
-
i0values.forEach((t) => {
|
|
18878
|
-
if (t instanceof import_drizzle_orm_sqlite.SQLiteTable) {
|
|
18879
|
-
tables.push(t);
|
|
18880
|
-
}
|
|
18881
|
-
});
|
|
18882
|
-
});
|
|
18883
|
-
return { tables, enums };
|
|
18884
|
-
};
|
|
18885
|
-
|
|
18886
|
-
// src/serializer/index.ts
|
|
18887
|
-
var import_path = __toESM(require("path"));
|
|
17081
|
+
var commonMySqlSchema = schema;
|
|
18888
17082
|
|
|
18889
|
-
// src/serializer/
|
|
18890
|
-
var
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
|
|
18931
|
-
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
|
|
18935
|
-
|
|
18936
|
-
|
|
18937
|
-
|
|
18938
|
-
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
let indexColumns = columns.map((it) => {
|
|
18956
|
-
if (it instanceof import_sql2.SQL) {
|
|
18957
|
-
return dialect2.sqlToQuery(it).sql;
|
|
18958
|
-
} else {
|
|
18959
|
-
return it.name;
|
|
18960
|
-
}
|
|
18961
|
-
});
|
|
18962
|
-
let where = void 0;
|
|
18963
|
-
if (value.config.where !== void 0) {
|
|
18964
|
-
if (value.config.where instanceof import_sql2.SQL) {
|
|
18965
|
-
where = dialect2.sqlToQuery(value.config.where).sql;
|
|
18966
|
-
}
|
|
18967
|
-
}
|
|
18968
|
-
indexesObject[name] = {
|
|
18969
|
-
name,
|
|
18970
|
-
columns: indexColumns,
|
|
18971
|
-
isUnique: (_a = value.config.unique) != null ? _a : false,
|
|
18972
|
-
where
|
|
18973
|
-
};
|
|
17083
|
+
// src/serializer/sqliteSchema.ts
|
|
17084
|
+
var index2 = objectType({
|
|
17085
|
+
name: stringType(),
|
|
17086
|
+
columns: stringType().array(),
|
|
17087
|
+
where: stringType().optional(),
|
|
17088
|
+
isUnique: booleanType()
|
|
17089
|
+
}).strict();
|
|
17090
|
+
var fk2 = objectType({
|
|
17091
|
+
name: stringType(),
|
|
17092
|
+
tableFrom: stringType(),
|
|
17093
|
+
columnsFrom: stringType().array(),
|
|
17094
|
+
tableTo: stringType(),
|
|
17095
|
+
columnsTo: stringType().array(),
|
|
17096
|
+
onUpdate: stringType().optional(),
|
|
17097
|
+
onDelete: stringType().optional()
|
|
17098
|
+
}).strict();
|
|
17099
|
+
var column2 = objectType({
|
|
17100
|
+
name: stringType(),
|
|
17101
|
+
type: stringType(),
|
|
17102
|
+
primaryKey: booleanType(),
|
|
17103
|
+
notNull: booleanType(),
|
|
17104
|
+
default: anyType().optional()
|
|
17105
|
+
}).strict();
|
|
17106
|
+
var table2 = objectType({
|
|
17107
|
+
name: stringType(),
|
|
17108
|
+
columns: recordType(stringType(), column2),
|
|
17109
|
+
indexes: recordType(stringType(), index2),
|
|
17110
|
+
foreignKeys: recordType(stringType(), fk2)
|
|
17111
|
+
}).strict();
|
|
17112
|
+
var dialect2 = enumType(["sqlite"]);
|
|
17113
|
+
var schemaHash2 = objectType({
|
|
17114
|
+
id: stringType(),
|
|
17115
|
+
prevId: stringType()
|
|
17116
|
+
});
|
|
17117
|
+
var schemaInternal2 = objectType({
|
|
17118
|
+
version: literalType("3"),
|
|
17119
|
+
dialect: dialect2,
|
|
17120
|
+
tables: recordType(stringType(), table2),
|
|
17121
|
+
enums: objectType({})
|
|
17122
|
+
}).strict();
|
|
17123
|
+
var schema2 = schemaInternal2.merge(schemaHash2);
|
|
17124
|
+
var tableSquashed2 = objectType({
|
|
17125
|
+
name: stringType(),
|
|
17126
|
+
columns: recordType(stringType(), column2),
|
|
17127
|
+
indexes: recordType(stringType(), stringType()),
|
|
17128
|
+
foreignKeys: recordType(stringType(), stringType())
|
|
17129
|
+
}).strict();
|
|
17130
|
+
var schemaSquashed2 = objectType({
|
|
17131
|
+
version: literalType("3"),
|
|
17132
|
+
dialect: dialect2,
|
|
17133
|
+
tables: recordType(stringType(), tableSquashed2),
|
|
17134
|
+
enums: anyType()
|
|
17135
|
+
}).strict();
|
|
17136
|
+
var SQLiteSquasher = {
|
|
17137
|
+
squashIdx: (idx) => {
|
|
17138
|
+
var _a;
|
|
17139
|
+
index2.parse(idx);
|
|
17140
|
+
return `${idx.name};${idx.columns.join(",")};${idx.isUnique};${(_a = idx.where) != null ? _a : ""}`;
|
|
17141
|
+
},
|
|
17142
|
+
unsquashIdx: (input) => {
|
|
17143
|
+
const [name, columnsString, isUnique, where] = input.split(";");
|
|
17144
|
+
const result = index2.parse({
|
|
17145
|
+
name,
|
|
17146
|
+
columns: columnsString.split(","),
|
|
17147
|
+
isUnique: isUnique === "true",
|
|
17148
|
+
where: where != null ? where : void 0
|
|
18974
17149
|
});
|
|
18975
|
-
result
|
|
18976
|
-
|
|
18977
|
-
|
|
18978
|
-
|
|
18979
|
-
|
|
18980
|
-
|
|
18981
|
-
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
|
|
18991
|
-
|
|
18992
|
-
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
unregister();
|
|
19002
|
-
return generateSqliteSnapshot(tables, enums);
|
|
19003
|
-
} else {
|
|
19004
|
-
return {};
|
|
17150
|
+
return result;
|
|
17151
|
+
},
|
|
17152
|
+
squashFK: (fk4) => {
|
|
17153
|
+
var _a, _b;
|
|
17154
|
+
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${(_a = fk4.onUpdate) != null ? _a : ""};${(_b = fk4.onDelete) != null ? _b : ""}`;
|
|
17155
|
+
},
|
|
17156
|
+
unsquashFK: (input) => {
|
|
17157
|
+
const [
|
|
17158
|
+
name,
|
|
17159
|
+
tableFrom,
|
|
17160
|
+
columnsFromStr,
|
|
17161
|
+
tableTo,
|
|
17162
|
+
columnsToStr,
|
|
17163
|
+
onUpdate,
|
|
17164
|
+
onDelete
|
|
17165
|
+
] = input.split(";");
|
|
17166
|
+
const result = fk2.parse({
|
|
17167
|
+
name,
|
|
17168
|
+
tableFrom,
|
|
17169
|
+
columnsFrom: columnsFromStr.split(","),
|
|
17170
|
+
tableTo,
|
|
17171
|
+
columnsTo: columnsToStr.split(","),
|
|
17172
|
+
onUpdate,
|
|
17173
|
+
onDelete
|
|
17174
|
+
});
|
|
17175
|
+
return result;
|
|
19005
17176
|
}
|
|
19006
17177
|
};
|
|
19007
|
-
var
|
|
17178
|
+
var commonSqliteSchema = schema2;
|
|
19008
17179
|
|
|
19009
|
-
// src/
|
|
19010
|
-
var
|
|
17180
|
+
// src/schemaValidator.ts
|
|
17181
|
+
var indexV2 = objectType({
|
|
17182
|
+
name: stringType(),
|
|
17183
|
+
columns: recordType(
|
|
17184
|
+
stringType(),
|
|
17185
|
+
objectType({
|
|
17186
|
+
name: stringType()
|
|
17187
|
+
})
|
|
17188
|
+
),
|
|
17189
|
+
isUnique: booleanType()
|
|
17190
|
+
}).strict();
|
|
17191
|
+
var columnV2 = objectType({
|
|
17192
|
+
name: stringType(),
|
|
17193
|
+
type: stringType(),
|
|
17194
|
+
primaryKey: booleanType(),
|
|
17195
|
+
notNull: booleanType(),
|
|
17196
|
+
default: anyType().optional(),
|
|
17197
|
+
references: stringType().optional()
|
|
17198
|
+
}).strict();
|
|
17199
|
+
var tableV2 = objectType({
|
|
17200
|
+
name: stringType(),
|
|
17201
|
+
columns: recordType(stringType(), columnV2),
|
|
17202
|
+
indexes: recordType(stringType(), indexV2)
|
|
17203
|
+
}).strict();
|
|
17204
|
+
var enumSchema = objectType({
|
|
17205
|
+
name: stringType(),
|
|
17206
|
+
values: recordType(stringType(), stringType())
|
|
17207
|
+
}).strict();
|
|
17208
|
+
var schemaV2 = objectType({
|
|
17209
|
+
version: literalType("2"),
|
|
17210
|
+
tables: recordType(stringType(), tableV2),
|
|
17211
|
+
enums: recordType(stringType(), enumSchema)
|
|
17212
|
+
}).strict();
|
|
17213
|
+
var references = objectType({
|
|
17214
|
+
foreignKeyName: stringType(),
|
|
17215
|
+
table: stringType(),
|
|
17216
|
+
column: stringType(),
|
|
17217
|
+
onDelete: stringType().optional(),
|
|
17218
|
+
onUpdate: stringType().optional()
|
|
17219
|
+
}).strict();
|
|
17220
|
+
var columnV1 = objectType({
|
|
17221
|
+
name: stringType(),
|
|
17222
|
+
type: stringType(),
|
|
17223
|
+
primaryKey: booleanType(),
|
|
17224
|
+
notNull: booleanType(),
|
|
17225
|
+
default: anyType().optional(),
|
|
17226
|
+
references: references.optional()
|
|
17227
|
+
}).strict();
|
|
17228
|
+
var tableV1 = objectType({
|
|
17229
|
+
name: stringType(),
|
|
17230
|
+
columns: recordType(stringType(), columnV1),
|
|
17231
|
+
indexes: recordType(stringType(), indexV2)
|
|
17232
|
+
}).strict();
|
|
17233
|
+
var schemaV1 = objectType({
|
|
17234
|
+
version: literalType("1"),
|
|
17235
|
+
tables: recordType(stringType(), tableV1),
|
|
17236
|
+
enums: recordType(stringType(), enumSchema)
|
|
17237
|
+
}).strict();
|
|
17238
|
+
var index3 = objectType({
|
|
19011
17239
|
name: stringType(),
|
|
19012
17240
|
columns: stringType().array(),
|
|
19013
|
-
where: stringType().optional(),
|
|
19014
17241
|
isUnique: booleanType()
|
|
19015
17242
|
}).strict();
|
|
19016
|
-
var
|
|
17243
|
+
var fk3 = objectType({
|
|
19017
17244
|
name: stringType(),
|
|
19018
17245
|
tableFrom: stringType(),
|
|
19019
17246
|
columnsFrom: stringType().array(),
|
|
@@ -19022,56 +17249,54 @@ var fk2 = objectType({
|
|
|
19022
17249
|
onUpdate: stringType().optional(),
|
|
19023
17250
|
onDelete: stringType().optional()
|
|
19024
17251
|
}).strict();
|
|
19025
|
-
var
|
|
17252
|
+
var column3 = objectType({
|
|
19026
17253
|
name: stringType(),
|
|
19027
17254
|
type: stringType(),
|
|
19028
17255
|
primaryKey: booleanType(),
|
|
19029
17256
|
notNull: booleanType(),
|
|
19030
17257
|
default: anyType().optional()
|
|
19031
17258
|
}).strict();
|
|
19032
|
-
var
|
|
17259
|
+
var table3 = objectType({
|
|
19033
17260
|
name: stringType(),
|
|
19034
|
-
columns: recordType(stringType(),
|
|
19035
|
-
indexes: recordType(stringType(),
|
|
19036
|
-
foreignKeys: recordType(stringType(),
|
|
17261
|
+
columns: recordType(stringType(), column3),
|
|
17262
|
+
indexes: recordType(stringType(), index3),
|
|
17263
|
+
foreignKeys: recordType(stringType(), fk3)
|
|
19037
17264
|
}).strict();
|
|
19038
|
-
var dialect3 = enumType(["sqlite"]);
|
|
19039
|
-
var
|
|
17265
|
+
var dialect3 = enumType(["pg", "mysql", "sqlite"]);
|
|
17266
|
+
var schemaHash3 = objectType({
|
|
19040
17267
|
id: stringType(),
|
|
19041
17268
|
prevId: stringType()
|
|
19042
17269
|
});
|
|
19043
|
-
var
|
|
17270
|
+
var schemaInternal3 = objectType({
|
|
19044
17271
|
version: literalType("3"),
|
|
19045
17272
|
dialect: dialect3,
|
|
19046
|
-
tables: recordType(stringType(),
|
|
19047
|
-
enums:
|
|
17273
|
+
tables: recordType(stringType(), table3),
|
|
17274
|
+
enums: recordType(stringType(), enumSchema)
|
|
19048
17275
|
}).strict();
|
|
19049
|
-
var
|
|
19050
|
-
var
|
|
17276
|
+
var schema3 = schemaInternal3.merge(schemaHash3);
|
|
17277
|
+
var tableSquashed3 = objectType({
|
|
19051
17278
|
name: stringType(),
|
|
19052
|
-
columns: recordType(stringType(),
|
|
17279
|
+
columns: recordType(stringType(), column3),
|
|
19053
17280
|
indexes: recordType(stringType(), stringType()),
|
|
19054
17281
|
foreignKeys: recordType(stringType(), stringType())
|
|
19055
17282
|
}).strict();
|
|
19056
|
-
var
|
|
17283
|
+
var schemaSquashed3 = objectType({
|
|
19057
17284
|
version: literalType("3"),
|
|
19058
17285
|
dialect: dialect3,
|
|
19059
|
-
tables: recordType(stringType(),
|
|
19060
|
-
enums:
|
|
17286
|
+
tables: recordType(stringType(), tableSquashed3),
|
|
17287
|
+
enums: recordType(stringType(), enumSchema)
|
|
19061
17288
|
}).strict();
|
|
19062
|
-
var
|
|
17289
|
+
var PgSquasher = {
|
|
19063
17290
|
squashIdx: (idx) => {
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
return `${idx.name};${idx.columns.join(",")};${idx.isUnique};${(_a = idx.where) != null ? _a : ""}`;
|
|
17291
|
+
index3.parse(idx);
|
|
17292
|
+
return `${idx.name};${idx.columns.join(",")};${idx.isUnique}`;
|
|
19067
17293
|
},
|
|
19068
17294
|
unsquashIdx: (input) => {
|
|
19069
|
-
const [name, columnsString, isUnique
|
|
19070
|
-
const result =
|
|
17295
|
+
const [name, columnsString, isUnique] = input.split(";");
|
|
17296
|
+
const result = index3.parse({
|
|
19071
17297
|
name,
|
|
19072
17298
|
columns: columnsString.split(","),
|
|
19073
|
-
isUnique: isUnique === "true"
|
|
19074
|
-
where: where != null ? where : void 0
|
|
17299
|
+
isUnique: isUnique === "true"
|
|
19075
17300
|
});
|
|
19076
17301
|
return result;
|
|
19077
17302
|
},
|
|
@@ -19089,7 +17314,7 @@ var SQLiteSquasher = {
|
|
|
19089
17314
|
onUpdate,
|
|
19090
17315
|
onDelete
|
|
19091
17316
|
] = input.split(";");
|
|
19092
|
-
const result =
|
|
17317
|
+
const result = fk3.parse({
|
|
19093
17318
|
name,
|
|
19094
17319
|
tableFrom,
|
|
19095
17320
|
columnsFrom: columnsFromStr.split(","),
|
|
@@ -19101,6 +17326,42 @@ var SQLiteSquasher = {
|
|
|
19101
17326
|
return result;
|
|
19102
17327
|
}
|
|
19103
17328
|
};
|
|
17329
|
+
var commonSchema = unionType([schemaV1, schemaV2, schema3, commonMySqlSchema, commonSqliteSchema]);
|
|
17330
|
+
|
|
17331
|
+
// src/migrationPreparator.ts
|
|
17332
|
+
var import_crypto = require("crypto");
|
|
17333
|
+
|
|
17334
|
+
// src/serializer/index.ts
|
|
17335
|
+
var import_fs = __toESM(require("fs"));
|
|
17336
|
+
var import_node = __toESM(require_node2());
|
|
17337
|
+
var import_path = __toESM(require("path"));
|
|
17338
|
+
var serialize = (path3, dialect5) => {
|
|
17339
|
+
const fileName = import_fs.default.lstatSync(path3).isDirectory() ? null : import_path.default.resolve(path3);
|
|
17340
|
+
const filenames = fileName ? [fileName] : import_fs.default.readdirSync(path3).map((it) => import_path.default.join(import_path.default.resolve(path3), it));
|
|
17341
|
+
const { unregister } = (0, import_node.register)({
|
|
17342
|
+
target: "node10.4",
|
|
17343
|
+
loader: "ts"
|
|
17344
|
+
});
|
|
17345
|
+
if (dialect5 === "pg") {
|
|
17346
|
+
const { prepareFromImports: prepareFromImports2 } = (init_imports(), __toCommonJS(imports_exports));
|
|
17347
|
+
const { generatePgSnapshot: generatePgSnapshot2 } = (init_pgSerializer(), __toCommonJS(pgSerializer_exports));
|
|
17348
|
+
const { tables, enums } = prepareFromImports2(filenames);
|
|
17349
|
+
unregister();
|
|
17350
|
+
return generatePgSnapshot2(tables, enums);
|
|
17351
|
+
} else if (dialect5 === "mysql") {
|
|
17352
|
+
return {};
|
|
17353
|
+
} else if (dialect5 === "sqlite") {
|
|
17354
|
+
const { prepareFromSqliteImports: prepareFromSqliteImports2 } = (init_imports(), __toCommonJS(imports_exports));
|
|
17355
|
+
const { generateSqliteSnapshot: generateSqliteSnapshot2 } = (init_sqliteSerializer(), __toCommonJS(sqliteSerializer_exports));
|
|
17356
|
+
const { tables, enums } = prepareFromSqliteImports2(filenames);
|
|
17357
|
+
const result = generateSqliteSnapshot2(tables, enums);
|
|
17358
|
+
unregister();
|
|
17359
|
+
return result;
|
|
17360
|
+
} else {
|
|
17361
|
+
return {};
|
|
17362
|
+
}
|
|
17363
|
+
};
|
|
17364
|
+
var serializer_default = serialize;
|
|
19104
17365
|
|
|
19105
17366
|
// src/sqlgenerator.ts
|
|
19106
17367
|
var Convertor = class {
|
|
@@ -20111,110 +18372,9 @@ var prepareDropIndexesJson = (tableName, indexes) => {
|
|
|
20111
18372
|
});
|
|
20112
18373
|
};
|
|
20113
18374
|
|
|
20114
|
-
// src/serializer/mysqlSchema.ts
|
|
20115
|
-
var index3 = objectType({
|
|
20116
|
-
name: stringType(),
|
|
20117
|
-
columns: stringType().array(),
|
|
20118
|
-
isUnique: booleanType(),
|
|
20119
|
-
using: enumType(["btree", "hash"]).optional(),
|
|
20120
|
-
algorithm: enumType(["default", "inplace", "copy"]).optional(),
|
|
20121
|
-
lock: enumType(["default", "none", "shared", "exclusive"]).optional()
|
|
20122
|
-
}).strict();
|
|
20123
|
-
var fk3 = objectType({
|
|
20124
|
-
name: stringType(),
|
|
20125
|
-
tableFrom: stringType(),
|
|
20126
|
-
columnsFrom: stringType().array(),
|
|
20127
|
-
tableTo: stringType(),
|
|
20128
|
-
columnsTo: stringType().array(),
|
|
20129
|
-
onUpdate: stringType().optional(),
|
|
20130
|
-
onDelete: stringType().optional()
|
|
20131
|
-
}).strict();
|
|
20132
|
-
var column3 = objectType({
|
|
20133
|
-
name: stringType(),
|
|
20134
|
-
type: stringType(),
|
|
20135
|
-
primaryKey: booleanType(),
|
|
20136
|
-
notNull: booleanType(),
|
|
20137
|
-
autoincrement: booleanType().optional(),
|
|
20138
|
-
default: anyType().optional()
|
|
20139
|
-
}).strict();
|
|
20140
|
-
var table3 = objectType({
|
|
20141
|
-
name: stringType(),
|
|
20142
|
-
columns: recordType(stringType(), column3),
|
|
20143
|
-
indexes: recordType(stringType(), index3),
|
|
20144
|
-
foreignKeys: recordType(stringType(), fk3)
|
|
20145
|
-
}).strict();
|
|
20146
|
-
var dialect4 = enumType(["mysql"]);
|
|
20147
|
-
var schemaHash3 = objectType({
|
|
20148
|
-
id: stringType(),
|
|
20149
|
-
prevId: stringType()
|
|
20150
|
-
});
|
|
20151
|
-
var schemaInternal3 = objectType({
|
|
20152
|
-
version: literalType("3"),
|
|
20153
|
-
dialect: dialect4,
|
|
20154
|
-
tables: recordType(stringType(), table3),
|
|
20155
|
-
enums: objectType({})
|
|
20156
|
-
}).strict();
|
|
20157
|
-
var schema3 = schemaInternal3.merge(schemaHash3);
|
|
20158
|
-
var tableSquashed3 = objectType({
|
|
20159
|
-
name: stringType(),
|
|
20160
|
-
columns: recordType(stringType(), column3),
|
|
20161
|
-
indexes: recordType(stringType(), stringType()),
|
|
20162
|
-
foreignKeys: recordType(stringType(), stringType())
|
|
20163
|
-
}).strict();
|
|
20164
|
-
var schemaSquashed3 = objectType({
|
|
20165
|
-
version: literalType("3"),
|
|
20166
|
-
dialect: dialect4,
|
|
20167
|
-
tables: recordType(stringType(), tableSquashed3),
|
|
20168
|
-
enums: anyType()
|
|
20169
|
-
}).strict();
|
|
20170
|
-
var MySqlSquasher = {
|
|
20171
|
-
squashIdx: (idx) => {
|
|
20172
|
-
var _a, _b, _c;
|
|
20173
|
-
index3.parse(idx);
|
|
20174
|
-
return `${idx.name};${idx.columns.join(",")};${idx.isUnique};${(_a = idx.using) != null ? _a : ""};${(_b = idx.algorithm) != null ? _b : ""};${(_c = idx.lock) != null ? _c : ""}`;
|
|
20175
|
-
},
|
|
20176
|
-
unsquashIdx: (input) => {
|
|
20177
|
-
const [name, columnsString, isUnique, using, algorithm, lock] = input.split(";");
|
|
20178
|
-
const result = index3.parse({
|
|
20179
|
-
name,
|
|
20180
|
-
columns: columnsString.split(","),
|
|
20181
|
-
isUnique: isUnique === "true",
|
|
20182
|
-
using,
|
|
20183
|
-
algorithm,
|
|
20184
|
-
lock
|
|
20185
|
-
});
|
|
20186
|
-
return result;
|
|
20187
|
-
},
|
|
20188
|
-
squashFK: (fk4) => {
|
|
20189
|
-
var _a, _b;
|
|
20190
|
-
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${(_a = fk4.onUpdate) != null ? _a : ""};${(_b = fk4.onDelete) != null ? _b : ""}`;
|
|
20191
|
-
},
|
|
20192
|
-
unsquashFK: (input) => {
|
|
20193
|
-
const [
|
|
20194
|
-
name,
|
|
20195
|
-
tableFrom,
|
|
20196
|
-
columnsFromStr,
|
|
20197
|
-
tableTo,
|
|
20198
|
-
columnsToStr,
|
|
20199
|
-
onUpdate,
|
|
20200
|
-
onDelete
|
|
20201
|
-
] = input.split(";");
|
|
20202
|
-
const result = fk3.parse({
|
|
20203
|
-
name,
|
|
20204
|
-
tableFrom,
|
|
20205
|
-
columnsFrom: columnsFromStr.split(","),
|
|
20206
|
-
tableTo,
|
|
20207
|
-
columnsTo: columnsToStr.split(","),
|
|
20208
|
-
onUpdate,
|
|
20209
|
-
onDelete
|
|
20210
|
-
});
|
|
20211
|
-
return result;
|
|
20212
|
-
}
|
|
20213
|
-
};
|
|
20214
|
-
|
|
20215
18375
|
// src/snapshotsDiffer.ts
|
|
20216
18376
|
var originUUID = "00000000-0000-0000-0000-000000000000";
|
|
20217
|
-
var dryPg =
|
|
18377
|
+
var dryPg = schema3.parse({
|
|
20218
18378
|
version: "3",
|
|
20219
18379
|
dialect: "pg",
|
|
20220
18380
|
id: originUUID,
|
|
@@ -20222,7 +18382,7 @@ var dryPg = schema.parse({
|
|
|
20222
18382
|
tables: {},
|
|
20223
18383
|
enums: {}
|
|
20224
18384
|
});
|
|
20225
|
-
var dryMySql =
|
|
18385
|
+
var dryMySql = schema.parse({
|
|
20226
18386
|
version: "3",
|
|
20227
18387
|
dialect: "mysql",
|
|
20228
18388
|
id: originUUID,
|
|
@@ -21464,7 +19624,7 @@ var updateToLatest = (json, prevId) => {
|
|
|
21464
19624
|
const v2 = schemaV2.parse(json);
|
|
21465
19625
|
return update2to3(v2, prevId);
|
|
21466
19626
|
}
|
|
21467
|
-
return
|
|
19627
|
+
return schema3.parse(json);
|
|
21468
19628
|
};
|
|
21469
19629
|
var update1to2 = (json) => {
|
|
21470
19630
|
const tables = Object.fromEntries(
|