drizzle-kit 0.20.14-a77266f → 0.20.14-c82ab68
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +7311 -7010
- package/cli/commands/migrate.d.ts +24 -24
- package/cli/commands/mysqlIntrospect.d.ts +8 -8
- package/cli/commands/mysqlPushUtils.d.ts +2 -2
- package/cli/commands/mysqlUp.d.ts +2 -2
- package/cli/commands/pgConnect.d.ts +1 -1
- package/cli/commands/pgIntrospect.d.ts +12 -9
- package/cli/commands/pgPushUtils.d.ts +2 -2
- package/cli/commands/pgUp.d.ts +2 -2
- package/cli/commands/sqliteIntrospect.d.ts +9 -9
- package/cli/commands/sqlitePushUtils.d.ts +3 -3
- package/cli/commands/upFolders.d.ts +1 -1
- package/cli/commands/utils.d.ts +14 -259
- package/cli/validations/cli.d.ts +104 -0
- package/cli/validations/common.d.ts +205 -7
- package/cli/validations/mysql.d.ts +6 -1
- package/cli/validations/pg.d.ts +6 -1
- package/cli/validations/sqlite.d.ts +382 -0
- package/cli/views.d.ts +1 -1
- package/global.d.ts +1 -1
- package/index.d.mts +8 -6
- package/index.d.ts +8 -6
- package/index.js +1 -0
- package/introspect-mysql.d.ts +1 -1
- package/introspect-pg.d.ts +5 -2
- package/introspect-sqlite.d.ts +1 -1
- package/jsonStatements.d.ts +1 -1
- package/package.json +3 -1
- package/payload.js +2574 -1898
- package/payload.mjs +2570 -1895
- package/schemaValidator.d.ts +40 -40
- package/serializer/mysqlSchema.d.ts +1991 -753
- package/serializer/mysqlSerializer.d.ts +2 -2
- package/serializer/pgSchema.d.ts +1113 -788
- package/serializer/sqliteSchema.d.ts +144 -570
- package/serializer/sqliteSerializer.d.ts +2 -2
- package/snapshotsDiffer.d.ts +24 -20
- package/utils-studio.js +390 -15
- package/utils-studio.mjs +389 -15
- package/utils.d.ts +12 -12
- package/utils.js +849 -735
- package/utils.mjs +849 -736
- package/cli/commands/sqliteUtils.d.ts +0 -162
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { SQLiteSchemaInternal } from "../serializer/sqliteSchema";
|
2
2
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
3
|
-
import type { IntrospectStage, IntrospectStatus } from "
|
4
|
-
import type { DrizzleDbClient } from "
|
3
|
+
import type { IntrospectStage, IntrospectStatus } from "../cli/views";
|
4
|
+
import type { DrizzleDbClient } from "../drivers";
|
5
5
|
export declare const generateSqliteSnapshot: (tables: AnySQLiteTable[], enums: any[]) => SQLiteSchemaInternal;
|
6
6
|
export declare const fromDatabase: (db: DrizzleDbClient, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<SQLiteSchemaInternal>;
|
package/snapshotsDiffer.d.ts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
import { TypeOf, ZodTypeAny, z } from "zod";
|
2
2
|
import { JsonStatement } from "./jsonStatements";
|
3
|
-
import { CommonSquashedSchema
|
3
|
+
import { CommonSquashedSchema } from "./schemaValidator";
|
4
|
+
import { SQLiteSchema } from "./serializer/sqliteSchema";
|
5
|
+
import { MySqlSchema } from "./serializer/mysqlSchema";
|
6
|
+
import { PgSchema } from "./serializer/pgSchema";
|
4
7
|
export declare const makePatched: <T extends ZodTypeAny>(schema: T) => z.ZodUnion<[z.ZodObject<{
|
5
8
|
type: z.ZodLiteral<"added">;
|
6
9
|
value: T;
|
@@ -54,19 +57,19 @@ export declare const makePatched: <T extends ZodTypeAny>(schema: T) => z.ZodUnio
|
|
54
57
|
}>[k_3_2]; } : never>]>;
|
55
58
|
export declare const makeSelfOrPatched: <T extends ZodTypeAny>(schema: T) => z.ZodUnion<[z.ZodObject<{
|
56
59
|
type: z.ZodLiteral<"none">;
|
57
|
-
value:
|
60
|
+
value: T;
|
58
61
|
}, "strip", ZodTypeAny, z.objectUtil.addQuestionMarks<{
|
59
62
|
type: "none";
|
60
|
-
value: T["_output"]
|
63
|
+
value: T["_output"];
|
61
64
|
}> extends infer T_1 ? { [k_1 in keyof T_1]: z.objectUtil.addQuestionMarks<{
|
62
65
|
type: "none";
|
63
|
-
value: T["_output"]
|
66
|
+
value: T["_output"];
|
64
67
|
}>[k_1]; } : never, z.objectUtil.addQuestionMarks<{
|
65
68
|
type: "none";
|
66
|
-
value: T["_input"]
|
69
|
+
value: T["_input"];
|
67
70
|
}> extends infer T_2 ? { [k_3 in keyof T_2]: z.objectUtil.addQuestionMarks<{
|
68
71
|
type: "none";
|
69
|
-
value: T["_input"]
|
72
|
+
value: T["_input"];
|
70
73
|
}>[k_3]; } : never>, z.ZodObject<{
|
71
74
|
type: z.ZodLiteral<"added">;
|
72
75
|
value: T;
|
@@ -561,13 +564,13 @@ export declare const alteredTableScheme: z.ZodObject<{
|
|
561
564
|
name: z.ZodString;
|
562
565
|
schema: z.ZodUnion<[z.ZodObject<{
|
563
566
|
type: z.ZodLiteral<"none">;
|
564
|
-
value: z.
|
567
|
+
value: z.ZodString;
|
565
568
|
}, "strip", ZodTypeAny, {
|
566
|
-
value?: string | undefined;
|
567
569
|
type: "none";
|
570
|
+
value: string;
|
568
571
|
}, {
|
569
|
-
value?: string | undefined;
|
570
572
|
type: "none";
|
573
|
+
value: string;
|
571
574
|
}>, z.ZodObject<{
|
572
575
|
type: z.ZodLiteral<"added">;
|
573
576
|
value: z.ZodString;
|
@@ -1033,8 +1036,8 @@ export declare const alteredTableScheme: z.ZodObject<{
|
|
1033
1036
|
}, "strict", ZodTypeAny, {
|
1034
1037
|
name: string;
|
1035
1038
|
schema: {
|
1036
|
-
value?: string | undefined;
|
1037
1039
|
type: "none";
|
1040
|
+
value: string;
|
1038
1041
|
} | {
|
1039
1042
|
type: "added";
|
1040
1043
|
value: string;
|
@@ -1164,8 +1167,8 @@ export declare const alteredTableScheme: z.ZodObject<{
|
|
1164
1167
|
}, {
|
1165
1168
|
name: string;
|
1166
1169
|
schema: {
|
1167
|
-
value?: string | undefined;
|
1168
1170
|
type: "none";
|
1171
|
+
value: string;
|
1169
1172
|
} | {
|
1170
1173
|
type: "added";
|
1171
1174
|
value: string;
|
@@ -1458,13 +1461,13 @@ export declare const diffResultScheme: z.ZodObject<{
|
|
1458
1461
|
name: z.ZodString;
|
1459
1462
|
schema: z.ZodUnion<[z.ZodObject<{
|
1460
1463
|
type: z.ZodLiteral<"none">;
|
1461
|
-
value: z.
|
1464
|
+
value: z.ZodString;
|
1462
1465
|
}, "strip", ZodTypeAny, {
|
1463
|
-
value?: string | undefined;
|
1464
1466
|
type: "none";
|
1467
|
+
value: string;
|
1465
1468
|
}, {
|
1466
|
-
value?: string | undefined;
|
1467
1469
|
type: "none";
|
1470
|
+
value: string;
|
1468
1471
|
}>, z.ZodObject<{
|
1469
1472
|
type: z.ZodLiteral<"added">;
|
1470
1473
|
value: z.ZodString;
|
@@ -1930,8 +1933,8 @@ export declare const diffResultScheme: z.ZodObject<{
|
|
1930
1933
|
}, "strict", ZodTypeAny, {
|
1931
1934
|
name: string;
|
1932
1935
|
schema: {
|
1933
|
-
value?: string | undefined;
|
1934
1936
|
type: "none";
|
1937
|
+
value: string;
|
1935
1938
|
} | {
|
1936
1939
|
type: "added";
|
1937
1940
|
value: string;
|
@@ -2061,8 +2064,8 @@ export declare const diffResultScheme: z.ZodObject<{
|
|
2061
2064
|
}, {
|
2062
2065
|
name: string;
|
2063
2066
|
schema: {
|
2064
|
-
value?: string | undefined;
|
2065
2067
|
type: "none";
|
2068
|
+
value: string;
|
2066
2069
|
} | {
|
2067
2070
|
type: "added";
|
2068
2071
|
value: string;
|
@@ -2269,8 +2272,8 @@ export declare const diffResultScheme: z.ZodObject<{
|
|
2269
2272
|
alteredTablesWithColumns: {
|
2270
2273
|
name: string;
|
2271
2274
|
schema: {
|
2272
|
-
value?: string | undefined;
|
2273
2275
|
type: "none";
|
2276
|
+
value: string;
|
2274
2277
|
} | {
|
2275
2278
|
type: "added";
|
2276
2279
|
value: string;
|
@@ -2457,8 +2460,8 @@ export declare const diffResultScheme: z.ZodObject<{
|
|
2457
2460
|
alteredTablesWithColumns: {
|
2458
2461
|
name: string;
|
2459
2462
|
schema: {
|
2460
|
-
value?: string | undefined;
|
2461
2463
|
type: "none";
|
2464
|
+
value: string;
|
2462
2465
|
} | {
|
2463
2466
|
type: "added";
|
2464
2467
|
value: string;
|
@@ -2644,11 +2647,12 @@ export interface ColumnsResolverOutput<T extends {
|
|
2644
2647
|
}[];
|
2645
2648
|
deleted: T[];
|
2646
2649
|
}
|
2647
|
-
export
|
2650
|
+
export type SchemaFrom<D> = D extends "pg" ? PgSchema : D extends "mysql" ? MySqlSchema : D extends "sqlite" ? SQLiteSchema : undefined;
|
2651
|
+
export declare const applySnapshotsDiff: <DIALECT extends "mysql" | "pg" | "sqlite" = "mysql" | "pg" | "sqlite">(json1: CommonSquashedSchema, json2: CommonSquashedSchema, dialect: DIALECT, schemasResolver: (input: TablesResolverInput<{
|
2648
2652
|
name: string;
|
2649
2653
|
}>) => Promise<TablesResolverOutput<{
|
2650
2654
|
name: string;
|
2651
|
-
}>>, tablesResolver: (input: TablesResolverInput<Table>) => Promise<TablesResolverOutput<Table>>, columnsResolver: (input: ColumnsResolverInput<Column>) => Promise<ColumnsResolverOutput<Column>>, prevFull
|
2655
|
+
}>>, tablesResolver: (input: TablesResolverInput<Table>) => Promise<TablesResolverOutput<Table>>, columnsResolver: (input: ColumnsResolverInput<Column>) => Promise<ColumnsResolverOutput<Column>>, prevFull: SchemaFrom<DIALECT>, curFull: SchemaFrom<DIALECT>) => Promise<{
|
2652
2656
|
statements: JsonStatement[];
|
2653
2657
|
sqlStatements: string[];
|
2654
2658
|
_meta: {
|
package/utils-studio.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
"use strict";
|
1
2
|
var __create = Object.create;
|
2
3
|
var __defProp = Object.defineProperty;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -1076,15 +1077,26 @@ var require_hanji = __commonJS({
|
|
1076
1077
|
var import_hanji;
|
1077
1078
|
var init_views = __esm({
|
1078
1079
|
"src/cli/views.ts"() {
|
1080
|
+
"use strict";
|
1079
1081
|
init_source();
|
1080
1082
|
import_hanji = __toESM(require_hanji());
|
1081
1083
|
}
|
1082
1084
|
});
|
1083
1085
|
|
1086
|
+
// src/global.ts
|
1087
|
+
var originUUID;
|
1088
|
+
var init_global = __esm({
|
1089
|
+
"src/global.ts"() {
|
1090
|
+
"use strict";
|
1091
|
+
originUUID = "00000000-0000-0000-0000-000000000000";
|
1092
|
+
}
|
1093
|
+
});
|
1094
|
+
|
1084
1095
|
// src/serializer/index.ts
|
1085
1096
|
var glob;
|
1086
1097
|
var init_serializer = __esm({
|
1087
1098
|
"src/serializer/index.ts"() {
|
1099
|
+
"use strict";
|
1088
1100
|
glob = __toESM(require("glob"));
|
1089
1101
|
init_source();
|
1090
1102
|
init_views();
|
@@ -1094,12 +1106,14 @@ var init_serializer = __esm({
|
|
1094
1106
|
// src/cli/validations/outputs.ts
|
1095
1107
|
var init_outputs = __esm({
|
1096
1108
|
"src/cli/validations/outputs.ts"() {
|
1109
|
+
"use strict";
|
1097
1110
|
init_source();
|
1098
1111
|
}
|
1099
1112
|
});
|
1100
1113
|
|
1101
1114
|
// src/serializer/sqliteSerializer.ts
|
1102
1115
|
function mapSqlToSqliteType(sqlType) {
|
1116
|
+
const lowered = sqlType.toLowerCase();
|
1103
1117
|
if ([
|
1104
1118
|
"int",
|
1105
1119
|
"integer",
|
@@ -1111,24 +1125,27 @@ function mapSqlToSqliteType(sqlType) {
|
|
1111
1125
|
"unsigned big int",
|
1112
1126
|
"int2",
|
1113
1127
|
"int8"
|
1114
|
-
].
|
1128
|
+
].some((it) => lowered.startsWith(it))) {
|
1115
1129
|
return "integer";
|
1116
1130
|
} else if ([
|
1117
1131
|
"character",
|
1118
1132
|
"varchar",
|
1119
|
-
"
|
1133
|
+
"varying character",
|
1134
|
+
"national varying character",
|
1120
1135
|
"nchar",
|
1121
1136
|
"native character",
|
1122
1137
|
"nvarchar",
|
1123
1138
|
"text",
|
1124
1139
|
"clob"
|
1125
|
-
].some((it) =>
|
1140
|
+
].some((it) => lowered.startsWith(it))) {
|
1141
|
+
const match2 = lowered.match(/\d+/);
|
1142
|
+
if (match2) {
|
1143
|
+
return `text(${match2[0]})`;
|
1144
|
+
}
|
1126
1145
|
return "text";
|
1127
|
-
} else if (
|
1146
|
+
} else if (lowered.startsWith("blob")) {
|
1128
1147
|
return "blob";
|
1129
|
-
} else if (["real", "double", "double precision", "float"].
|
1130
|
-
sqlType.toLowerCase()
|
1131
|
-
)) {
|
1148
|
+
} else if (["real", "double", "double precision", "float"].some((it) => lowered.startsWith(it))) {
|
1132
1149
|
return "real";
|
1133
1150
|
} else {
|
1134
1151
|
return "numeric";
|
@@ -1137,6 +1154,7 @@ function mapSqlToSqliteType(sqlType) {
|
|
1137
1154
|
var import_drizzle_orm, import_sqlite_core2, dialect, fromDatabase;
|
1138
1155
|
var init_sqliteSerializer = __esm({
|
1139
1156
|
"src/serializer/sqliteSerializer.ts"() {
|
1157
|
+
"use strict";
|
1140
1158
|
import_drizzle_orm = require("drizzle-orm");
|
1141
1159
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
1142
1160
|
init_serializer();
|
@@ -1555,6 +1573,7 @@ var require_brace_expansion = __commonJS({
|
|
1555
1573
|
var import_pg_core2, import_pg_core3, import_drizzle_orm2, dialect2, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
1556
1574
|
var init_pgSerializer = __esm({
|
1557
1575
|
"src/serializer/pgSerializer.ts"() {
|
1576
|
+
"use strict";
|
1558
1577
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
1559
1578
|
import_pg_core3 = require("drizzle-orm/pg-core");
|
1560
1579
|
import_drizzle_orm2 = require("drizzle-orm");
|
@@ -1571,7 +1590,7 @@ var init_pgSerializer = __esm({
|
|
1571
1590
|
--end;
|
1572
1591
|
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
|
1573
1592
|
};
|
1574
|
-
fromDatabase2 = async (db, tablesFilter = (
|
1593
|
+
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
|
1575
1594
|
const result = {};
|
1576
1595
|
const internals = { tables: {} };
|
1577
1596
|
const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
|
@@ -1898,7 +1917,7 @@ var init_pgSerializer = __esm({
|
|
1898
1917
|
}
|
1899
1918
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
1900
1919
|
return {
|
1901
|
-
version: "
|
1920
|
+
version: "6",
|
1902
1921
|
dialect: "pg",
|
1903
1922
|
tables: result,
|
1904
1923
|
enums: enumsToReturn,
|
@@ -1970,10 +1989,368 @@ var init_pgSerializer = __esm({
|
|
1970
1989
|
}
|
1971
1990
|
});
|
1972
1991
|
|
1992
|
+
// node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js
|
1993
|
+
var require_pluralize = __commonJS({
|
1994
|
+
"node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js"(exports, module2) {
|
1995
|
+
(function(root, pluralize) {
|
1996
|
+
if (typeof require === "function" && typeof exports === "object" && typeof module2 === "object") {
|
1997
|
+
module2.exports = pluralize();
|
1998
|
+
} else if (typeof define === "function" && define.amd) {
|
1999
|
+
define(function() {
|
2000
|
+
return pluralize();
|
2001
|
+
});
|
2002
|
+
} else {
|
2003
|
+
root.pluralize = pluralize();
|
2004
|
+
}
|
2005
|
+
})(exports, function() {
|
2006
|
+
var pluralRules = [];
|
2007
|
+
var singularRules = [];
|
2008
|
+
var uncountables = {};
|
2009
|
+
var irregularPlurals = {};
|
2010
|
+
var irregularSingles = {};
|
2011
|
+
function sanitizeRule(rule) {
|
2012
|
+
if (typeof rule === "string") {
|
2013
|
+
return new RegExp("^" + rule + "$", "i");
|
2014
|
+
}
|
2015
|
+
return rule;
|
2016
|
+
}
|
2017
|
+
function restoreCase(word, token) {
|
2018
|
+
if (word === token)
|
2019
|
+
return token;
|
2020
|
+
if (word === word.toLowerCase())
|
2021
|
+
return token.toLowerCase();
|
2022
|
+
if (word === word.toUpperCase())
|
2023
|
+
return token.toUpperCase();
|
2024
|
+
if (word[0] === word[0].toUpperCase()) {
|
2025
|
+
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
|
2026
|
+
}
|
2027
|
+
return token.toLowerCase();
|
2028
|
+
}
|
2029
|
+
function interpolate(str, args) {
|
2030
|
+
return str.replace(/\$(\d{1,2})/g, function(match2, index) {
|
2031
|
+
return args[index] || "";
|
2032
|
+
});
|
2033
|
+
}
|
2034
|
+
function replace(word, rule) {
|
2035
|
+
return word.replace(rule[0], function(match2, index) {
|
2036
|
+
var result = interpolate(rule[1], arguments);
|
2037
|
+
if (match2 === "") {
|
2038
|
+
return restoreCase(word[index - 1], result);
|
2039
|
+
}
|
2040
|
+
return restoreCase(match2, result);
|
2041
|
+
});
|
2042
|
+
}
|
2043
|
+
function sanitizeWord(token, word, rules) {
|
2044
|
+
if (!token.length || uncountables.hasOwnProperty(token)) {
|
2045
|
+
return word;
|
2046
|
+
}
|
2047
|
+
var len = rules.length;
|
2048
|
+
while (len--) {
|
2049
|
+
var rule = rules[len];
|
2050
|
+
if (rule[0].test(word))
|
2051
|
+
return replace(word, rule);
|
2052
|
+
}
|
2053
|
+
return word;
|
2054
|
+
}
|
2055
|
+
function replaceWord(replaceMap, keepMap, rules) {
|
2056
|
+
return function(word) {
|
2057
|
+
var token = word.toLowerCase();
|
2058
|
+
if (keepMap.hasOwnProperty(token)) {
|
2059
|
+
return restoreCase(word, token);
|
2060
|
+
}
|
2061
|
+
if (replaceMap.hasOwnProperty(token)) {
|
2062
|
+
return restoreCase(word, replaceMap[token]);
|
2063
|
+
}
|
2064
|
+
return sanitizeWord(token, word, rules);
|
2065
|
+
};
|
2066
|
+
}
|
2067
|
+
function checkWord(replaceMap, keepMap, rules, bool) {
|
2068
|
+
return function(word) {
|
2069
|
+
var token = word.toLowerCase();
|
2070
|
+
if (keepMap.hasOwnProperty(token))
|
2071
|
+
return true;
|
2072
|
+
if (replaceMap.hasOwnProperty(token))
|
2073
|
+
return false;
|
2074
|
+
return sanitizeWord(token, token, rules) === token;
|
2075
|
+
};
|
2076
|
+
}
|
2077
|
+
function pluralize(word, count, inclusive) {
|
2078
|
+
var pluralized = count === 1 ? pluralize.singular(word) : pluralize.plural(word);
|
2079
|
+
return (inclusive ? count + " " : "") + pluralized;
|
2080
|
+
}
|
2081
|
+
pluralize.plural = replaceWord(
|
2082
|
+
irregularSingles,
|
2083
|
+
irregularPlurals,
|
2084
|
+
pluralRules
|
2085
|
+
);
|
2086
|
+
pluralize.isPlural = checkWord(
|
2087
|
+
irregularSingles,
|
2088
|
+
irregularPlurals,
|
2089
|
+
pluralRules
|
2090
|
+
);
|
2091
|
+
pluralize.singular = replaceWord(
|
2092
|
+
irregularPlurals,
|
2093
|
+
irregularSingles,
|
2094
|
+
singularRules
|
2095
|
+
);
|
2096
|
+
pluralize.isSingular = checkWord(
|
2097
|
+
irregularPlurals,
|
2098
|
+
irregularSingles,
|
2099
|
+
singularRules
|
2100
|
+
);
|
2101
|
+
pluralize.addPluralRule = function(rule, replacement) {
|
2102
|
+
pluralRules.push([sanitizeRule(rule), replacement]);
|
2103
|
+
};
|
2104
|
+
pluralize.addSingularRule = function(rule, replacement) {
|
2105
|
+
singularRules.push([sanitizeRule(rule), replacement]);
|
2106
|
+
};
|
2107
|
+
pluralize.addUncountableRule = function(word) {
|
2108
|
+
if (typeof word === "string") {
|
2109
|
+
uncountables[word.toLowerCase()] = true;
|
2110
|
+
return;
|
2111
|
+
}
|
2112
|
+
pluralize.addPluralRule(word, "$0");
|
2113
|
+
pluralize.addSingularRule(word, "$0");
|
2114
|
+
};
|
2115
|
+
pluralize.addIrregularRule = function(single, plural2) {
|
2116
|
+
plural2 = plural2.toLowerCase();
|
2117
|
+
single = single.toLowerCase();
|
2118
|
+
irregularSingles[single] = plural2;
|
2119
|
+
irregularPlurals[plural2] = single;
|
2120
|
+
};
|
2121
|
+
[
|
2122
|
+
// Pronouns.
|
2123
|
+
["I", "we"],
|
2124
|
+
["me", "us"],
|
2125
|
+
["he", "they"],
|
2126
|
+
["she", "they"],
|
2127
|
+
["them", "them"],
|
2128
|
+
["myself", "ourselves"],
|
2129
|
+
["yourself", "yourselves"],
|
2130
|
+
["itself", "themselves"],
|
2131
|
+
["herself", "themselves"],
|
2132
|
+
["himself", "themselves"],
|
2133
|
+
["themself", "themselves"],
|
2134
|
+
["is", "are"],
|
2135
|
+
["was", "were"],
|
2136
|
+
["has", "have"],
|
2137
|
+
["this", "these"],
|
2138
|
+
["that", "those"],
|
2139
|
+
// Words ending in with a consonant and `o`.
|
2140
|
+
["echo", "echoes"],
|
2141
|
+
["dingo", "dingoes"],
|
2142
|
+
["volcano", "volcanoes"],
|
2143
|
+
["tornado", "tornadoes"],
|
2144
|
+
["torpedo", "torpedoes"],
|
2145
|
+
// Ends with `us`.
|
2146
|
+
["genus", "genera"],
|
2147
|
+
["viscus", "viscera"],
|
2148
|
+
// Ends with `ma`.
|
2149
|
+
["stigma", "stigmata"],
|
2150
|
+
["stoma", "stomata"],
|
2151
|
+
["dogma", "dogmata"],
|
2152
|
+
["lemma", "lemmata"],
|
2153
|
+
["schema", "schemata"],
|
2154
|
+
["anathema", "anathemata"],
|
2155
|
+
// Other irregular rules.
|
2156
|
+
["ox", "oxen"],
|
2157
|
+
["axe", "axes"],
|
2158
|
+
["die", "dice"],
|
2159
|
+
["yes", "yeses"],
|
2160
|
+
["foot", "feet"],
|
2161
|
+
["eave", "eaves"],
|
2162
|
+
["goose", "geese"],
|
2163
|
+
["tooth", "teeth"],
|
2164
|
+
["quiz", "quizzes"],
|
2165
|
+
["human", "humans"],
|
2166
|
+
["proof", "proofs"],
|
2167
|
+
["carve", "carves"],
|
2168
|
+
["valve", "valves"],
|
2169
|
+
["looey", "looies"],
|
2170
|
+
["thief", "thieves"],
|
2171
|
+
["groove", "grooves"],
|
2172
|
+
["pickaxe", "pickaxes"],
|
2173
|
+
["passerby", "passersby"]
|
2174
|
+
].forEach(function(rule) {
|
2175
|
+
return pluralize.addIrregularRule(rule[0], rule[1]);
|
2176
|
+
});
|
2177
|
+
[
|
2178
|
+
[/s?$/i, "s"],
|
2179
|
+
[/[^\u0000-\u007F]$/i, "$0"],
|
2180
|
+
[/([^aeiou]ese)$/i, "$1"],
|
2181
|
+
[/(ax|test)is$/i, "$1es"],
|
2182
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
|
2183
|
+
[/(e[mn]u)s?$/i, "$1s"],
|
2184
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
|
2185
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
|
2186
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
|
2187
|
+
[/(seraph|cherub)(?:im)?$/i, "$1im"],
|
2188
|
+
[/(her|at|gr)o$/i, "$1oes"],
|
2189
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
|
2190
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
|
2191
|
+
[/sis$/i, "ses"],
|
2192
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
|
2193
|
+
[/([^aeiouy]|qu)y$/i, "$1ies"],
|
2194
|
+
[/([^ch][ieo][ln])ey$/i, "$1ies"],
|
2195
|
+
[/(x|ch|ss|sh|zz)$/i, "$1es"],
|
2196
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
|
2197
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
|
2198
|
+
[/(pe)(?:rson|ople)$/i, "$1ople"],
|
2199
|
+
[/(child)(?:ren)?$/i, "$1ren"],
|
2200
|
+
[/eaux$/i, "$0"],
|
2201
|
+
[/m[ae]n$/i, "men"],
|
2202
|
+
["thou", "you"]
|
2203
|
+
].forEach(function(rule) {
|
2204
|
+
return pluralize.addPluralRule(rule[0], rule[1]);
|
2205
|
+
});
|
2206
|
+
[
|
2207
|
+
[/s$/i, ""],
|
2208
|
+
[/(ss)$/i, "$1"],
|
2209
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
|
2210
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
|
2211
|
+
[/ies$/i, "y"],
|
2212
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
|
2213
|
+
[/\b(mon|smil)ies$/i, "$1ey"],
|
2214
|
+
[/\b((?:tit)?m|l)ice$/i, "$1ouse"],
|
2215
|
+
[/(seraph|cherub)im$/i, "$1"],
|
2216
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
|
2217
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
|
2218
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
|
2219
|
+
[/(test)(?:is|es)$/i, "$1is"],
|
2220
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
|
2221
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
|
2222
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
|
2223
|
+
[/(alumn|alg|vertebr)ae$/i, "$1a"],
|
2224
|
+
[/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
|
2225
|
+
[/(matr|append)ices$/i, "$1ix"],
|
2226
|
+
[/(pe)(rson|ople)$/i, "$1rson"],
|
2227
|
+
[/(child)ren$/i, "$1"],
|
2228
|
+
[/(eau)x?$/i, "$1"],
|
2229
|
+
[/men$/i, "man"]
|
2230
|
+
].forEach(function(rule) {
|
2231
|
+
return pluralize.addSingularRule(rule[0], rule[1]);
|
2232
|
+
});
|
2233
|
+
[
|
2234
|
+
// Singular words with no plurals.
|
2235
|
+
"adulthood",
|
2236
|
+
"advice",
|
2237
|
+
"agenda",
|
2238
|
+
"aid",
|
2239
|
+
"aircraft",
|
2240
|
+
"alcohol",
|
2241
|
+
"ammo",
|
2242
|
+
"analytics",
|
2243
|
+
"anime",
|
2244
|
+
"athletics",
|
2245
|
+
"audio",
|
2246
|
+
"bison",
|
2247
|
+
"blood",
|
2248
|
+
"bream",
|
2249
|
+
"buffalo",
|
2250
|
+
"butter",
|
2251
|
+
"carp",
|
2252
|
+
"cash",
|
2253
|
+
"chassis",
|
2254
|
+
"chess",
|
2255
|
+
"clothing",
|
2256
|
+
"cod",
|
2257
|
+
"commerce",
|
2258
|
+
"cooperation",
|
2259
|
+
"corps",
|
2260
|
+
"debris",
|
2261
|
+
"diabetes",
|
2262
|
+
"digestion",
|
2263
|
+
"elk",
|
2264
|
+
"energy",
|
2265
|
+
"equipment",
|
2266
|
+
"excretion",
|
2267
|
+
"expertise",
|
2268
|
+
"firmware",
|
2269
|
+
"flounder",
|
2270
|
+
"fun",
|
2271
|
+
"gallows",
|
2272
|
+
"garbage",
|
2273
|
+
"graffiti",
|
2274
|
+
"hardware",
|
2275
|
+
"headquarters",
|
2276
|
+
"health",
|
2277
|
+
"herpes",
|
2278
|
+
"highjinks",
|
2279
|
+
"homework",
|
2280
|
+
"housework",
|
2281
|
+
"information",
|
2282
|
+
"jeans",
|
2283
|
+
"justice",
|
2284
|
+
"kudos",
|
2285
|
+
"labour",
|
2286
|
+
"literature",
|
2287
|
+
"machinery",
|
2288
|
+
"mackerel",
|
2289
|
+
"mail",
|
2290
|
+
"media",
|
2291
|
+
"mews",
|
2292
|
+
"moose",
|
2293
|
+
"music",
|
2294
|
+
"mud",
|
2295
|
+
"manga",
|
2296
|
+
"news",
|
2297
|
+
"only",
|
2298
|
+
"personnel",
|
2299
|
+
"pike",
|
2300
|
+
"plankton",
|
2301
|
+
"pliers",
|
2302
|
+
"police",
|
2303
|
+
"pollution",
|
2304
|
+
"premises",
|
2305
|
+
"rain",
|
2306
|
+
"research",
|
2307
|
+
"rice",
|
2308
|
+
"salmon",
|
2309
|
+
"scissors",
|
2310
|
+
"series",
|
2311
|
+
"sewage",
|
2312
|
+
"shambles",
|
2313
|
+
"shrimp",
|
2314
|
+
"software",
|
2315
|
+
"species",
|
2316
|
+
"staff",
|
2317
|
+
"swine",
|
2318
|
+
"tennis",
|
2319
|
+
"traffic",
|
2320
|
+
"transportation",
|
2321
|
+
"trout",
|
2322
|
+
"tuna",
|
2323
|
+
"wealth",
|
2324
|
+
"welfare",
|
2325
|
+
"whiting",
|
2326
|
+
"wildebeest",
|
2327
|
+
"wildlife",
|
2328
|
+
"you",
|
2329
|
+
/pok[eé]mon$/i,
|
2330
|
+
// Regexes.
|
2331
|
+
/[^aeiou]ese$/i,
|
2332
|
+
// "chinese", "japanese"
|
2333
|
+
/deer$/i,
|
2334
|
+
// "deer", "reindeer"
|
2335
|
+
/fish$/i,
|
2336
|
+
// "fish", "blowfish", "angelfish"
|
2337
|
+
/measles$/i,
|
2338
|
+
/o[iu]s$/i,
|
2339
|
+
// "carnivorous"
|
2340
|
+
/pox$/i,
|
2341
|
+
// "chickpox", "smallpox"
|
2342
|
+
/sheep$/i
|
2343
|
+
].forEach(pluralize.addUncountableRule);
|
2344
|
+
return pluralize;
|
2345
|
+
});
|
2346
|
+
}
|
2347
|
+
});
|
2348
|
+
|
1973
2349
|
// src/drivers/index.ts
|
1974
2350
|
var import_drizzle_orm4, DrizzleDbClient, DrizzleORMPgClient, TursoSqlite;
|
1975
2351
|
var init_drivers = __esm({
|
1976
2352
|
"src/drivers/index.ts"() {
|
2353
|
+
"use strict";
|
1977
2354
|
import_drizzle_orm4 = require("drizzle-orm");
|
1978
2355
|
DrizzleDbClient = class {
|
1979
2356
|
constructor(db) {
|
@@ -2166,11 +2543,7 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2166
2543
|
|
2167
2544
|
// src/cli/commands/sqliteIntrospect.ts
|
2168
2545
|
init_views();
|
2169
|
-
|
2170
|
-
// src/global.ts
|
2171
|
-
var originUUID = "00000000-0000-0000-0000-000000000000";
|
2172
|
-
|
2173
|
-
// src/cli/commands/sqliteIntrospect.ts
|
2546
|
+
init_global();
|
2174
2547
|
init_sqliteSerializer();
|
2175
2548
|
|
2176
2549
|
// node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
|
@@ -2272,7 +2645,7 @@ String.prototype.camelCase = function() {
|
|
2272
2645
|
return camelCase(String(this));
|
2273
2646
|
};
|
2274
2647
|
String.prototype.concatIf = function(it, condition) {
|
2275
|
-
return condition ? `${this}${it}` : this;
|
2648
|
+
return condition ? `${this}${it}` : String(this);
|
2276
2649
|
};
|
2277
2650
|
Array.prototype.random = function() {
|
2278
2651
|
return this[~~(Math.random() * this.length)];
|
@@ -3352,10 +3725,12 @@ init_pgSerializer();
|
|
3352
3725
|
|
3353
3726
|
// src/introspect-pg.ts
|
3354
3727
|
var import_drizzle_orm3 = require("drizzle-orm");
|
3728
|
+
var import_pluralize = __toESM(require_pluralize());
|
3355
3729
|
var import_relations = require("drizzle-orm/relations");
|
3356
3730
|
init_pgSerializer();
|
3357
3731
|
|
3358
3732
|
// src/cli/commands/pgIntrospect.ts
|
3733
|
+
init_global();
|
3359
3734
|
var pgPushIntrospect = async (connection, filters, schemaFilters) => {
|
3360
3735
|
const { client } = connection;
|
3361
3736
|
const matchers = filters.map((it) => {
|