drizzle-kit 0.20.14-22fcd3b → 0.20.14-441b049
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +40048 -40020
- package/cli/commands/mysqlIntrospect.d.ts +119 -0
- package/cli/commands/mysqlPushUtils.d.ts +18 -0
- package/cli/commands/sqlitePushUtils.d.ts +21 -0
- package/drivers/index.d.ts +14 -0
- package/global.d.ts +1 -0
- package/introspect-mysql.d.ts +9 -0
- package/package.json +15 -3
- package/payload.d.mts +33 -0
- package/payload.d.ts +33 -0
- package/payload.js +36792 -0
- package/payload.mjs +36811 -0
- package/serializer/mysqlImports.d.ts +5 -0
- package/serializer/mysqlSerializer.d.ts +2 -2
- package/serializer/sqliteImports.d.ts +4 -0
- package/utils-studio.js +12 -11
- package/utils-studio.mjs +8 -7
- package/utils.d.ts +1 -15
- package/utils.js +3626 -54861
- package/utils.mjs +8062 -0
- package/cli/utils.d.ts +0 -12
- package/cli/validations/sqlite.d.ts +0 -220
- package/cli/validations/studio.d.ts +0 -593
- package/orm-extenstions/d1-driver/driver.d.ts +0 -8
- package/orm-extenstions/d1-driver/session.d.ts +0 -51
- package/orm-extenstions/d1-driver/wrangler-client.d.ts +0 -3
- package/serializer/studioUtils.d.ts +0 -65
@@ -1,4 +1,9 @@
|
|
1
1
|
import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
|
2
|
+
export declare const prepareFromExports: (exports: Record<string, unknown>) => {
|
3
|
+
tables: AnyMySqlTable<{}>[];
|
4
|
+
enums: any[];
|
5
|
+
schemas: MySqlSchema<string>[];
|
6
|
+
};
|
2
7
|
export declare const prepareFromMySqlImports: (imports: string[]) => Promise<{
|
3
8
|
tables: AnyMySqlTable<{}>[];
|
4
9
|
enums: any[];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { AnyMySqlTable, MySqlSchema } from "drizzle-orm/mysql-core";
|
2
2
|
import { MySqlSchemaInternal } from "src/serializer/mysqlSchema";
|
3
|
-
import { Connection } from "mysql2/promise";
|
4
3
|
import { IntrospectStage, IntrospectStatus } from "src/cli/views";
|
4
|
+
import { DrizzleDbClient } from "src/drivers";
|
5
5
|
export declare const indexName: (tableName: string, columns: string[]) => string;
|
6
6
|
export declare const generateMySqlSnapshot: (tables: AnyMySqlTable[], enums: any[], mysqlSchemas: MySqlSchema[]) => MySqlSchemaInternal;
|
7
|
-
export declare const fromDatabase: (db:
|
7
|
+
export declare const fromDatabase: (db: DrizzleDbClient, inputSchema: string, tablesFilter?: (table: string) => boolean, progressCallback?: ((stage: IntrospectStage, count: number, status: IntrospectStatus) => void) | undefined) => Promise<MySqlSchemaInternal>;
|
@@ -1,4 +1,8 @@
|
|
1
1
|
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
2
|
+
export declare const prepareFromExports: (exports: Record<string, unknown>) => {
|
3
|
+
tables: AnySQLiteTable<{}>[];
|
4
|
+
enums: any[];
|
5
|
+
};
|
2
6
|
export declare const prepareFromSqliteImports: (imports: string[]) => Promise<{
|
3
7
|
tables: AnySQLiteTable<{}>[];
|
4
8
|
enums: any[];
|
package/utils-studio.js
CHANGED
@@ -1134,10 +1134,10 @@ function mapSqlToSqliteType(sqlType) {
|
|
1134
1134
|
return "numeric";
|
1135
1135
|
}
|
1136
1136
|
}
|
1137
|
-
var
|
1137
|
+
var import_drizzle_orm2, import_sqlite_core2, dialect, fromDatabase;
|
1138
1138
|
var init_sqliteSerializer = __esm({
|
1139
1139
|
"src/serializer/sqliteSerializer.ts"() {
|
1140
|
-
|
1140
|
+
import_drizzle_orm2 = require("drizzle-orm");
|
1141
1141
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
1142
1142
|
init_serializer();
|
1143
1143
|
init_outputs();
|
@@ -1552,12 +1552,12 @@ var require_brace_expansion = __commonJS({
|
|
1552
1552
|
});
|
1553
1553
|
|
1554
1554
|
// src/serializer/pgSerializer.ts
|
1555
|
-
var import_pg_core2, import_pg_core3,
|
1555
|
+
var import_pg_core2, import_pg_core3, import_drizzle_orm3, dialect2, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
1556
1556
|
var init_pgSerializer = __esm({
|
1557
1557
|
"src/serializer/pgSerializer.ts"() {
|
1558
1558
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
1559
1559
|
import_pg_core3 = require("drizzle-orm/pg-core");
|
1560
|
-
|
1560
|
+
import_drizzle_orm3 = require("drizzle-orm");
|
1561
1561
|
init_serializer();
|
1562
1562
|
init_source();
|
1563
1563
|
init_outputs();
|
@@ -1631,7 +1631,7 @@ var init_pgSerializer = __esm({
|
|
1631
1631
|
END AS data_type, INFORMATION_SCHEMA.COLUMNS.table_name, INFORMATION_SCHEMA.COLUMNS.column_name, INFORMATION_SCHEMA.COLUMNS.column_default, INFORMATION_SCHEMA.COLUMNS.data_type as additional_dt
|
1632
1632
|
FROM pg_attribute a
|
1633
1633
|
JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
|
1634
|
-
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1634
|
+
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}' and INFORMATION_SCHEMA.COLUMNS.table_schema = '${tableSchema}'
|
1635
1635
|
AND a.attnum > 0
|
1636
1636
|
AND NOT a.attisdropped
|
1637
1637
|
ORDER BY a.attnum;`
|
@@ -1971,10 +1971,10 @@ var init_pgSerializer = __esm({
|
|
1971
1971
|
});
|
1972
1972
|
|
1973
1973
|
// src/drivers/index.ts
|
1974
|
-
var
|
1974
|
+
var import_drizzle_orm5, DrizzleDbClient, DrizzleORMPgClient, TursoSqlite;
|
1975
1975
|
var init_drivers = __esm({
|
1976
1976
|
"src/drivers/index.ts"() {
|
1977
|
-
|
1977
|
+
import_drizzle_orm5 = require("drizzle-orm");
|
1978
1978
|
DrizzleDbClient = class {
|
1979
1979
|
constructor(db) {
|
1980
1980
|
this.db = db;
|
@@ -1982,11 +1982,11 @@ var init_drivers = __esm({
|
|
1982
1982
|
};
|
1983
1983
|
DrizzleORMPgClient = class extends DrizzleDbClient {
|
1984
1984
|
async query(query, values) {
|
1985
|
-
const res = await this.db.execute(
|
1985
|
+
const res = await this.db.execute(import_drizzle_orm5.sql.raw(query));
|
1986
1986
|
return res.rows;
|
1987
1987
|
}
|
1988
1988
|
async run(query) {
|
1989
|
-
const res = await this.db.execute(
|
1989
|
+
const res = await this.db.execute(import_drizzle_orm5.sql.raw(query));
|
1990
1990
|
return res.rows;
|
1991
1991
|
}
|
1992
1992
|
};
|
@@ -2015,6 +2015,7 @@ __export(utils_studio_exports, {
|
|
2015
2015
|
module.exports = __toCommonJS(utils_studio_exports);
|
2016
2016
|
|
2017
2017
|
// src/serializer/schemaToDrizzle.ts
|
2018
|
+
var import_drizzle_orm = require("drizzle-orm");
|
2018
2019
|
var import_pg_core = require("drizzle-orm/pg-core");
|
2019
2020
|
var import_sqlite_core = require("drizzle-orm/sqlite-core");
|
2020
2021
|
var pgSchemaToDrizzle = (schema, schemaName) => {
|
@@ -2142,7 +2143,7 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2142
2143
|
columnBuilder = columnBuilder.notNull();
|
2143
2144
|
}
|
2144
2145
|
if (c.default) {
|
2145
|
-
columnBuilder = columnBuilder.default(c.default);
|
2146
|
+
columnBuilder = columnBuilder.default(import_drizzle_orm.sql`${c.default}`);
|
2146
2147
|
}
|
2147
2148
|
if (c.primaryKey) {
|
2148
2149
|
columnBuilder = columnBuilder.primaryKey();
|
@@ -3351,7 +3352,7 @@ init_views();
|
|
3351
3352
|
init_pgSerializer();
|
3352
3353
|
|
3353
3354
|
// src/introspect-pg.ts
|
3354
|
-
var
|
3355
|
+
var import_drizzle_orm4 = require("drizzle-orm");
|
3355
3356
|
var import_relations = require("drizzle-orm/relations");
|
3356
3357
|
init_pgSerializer();
|
3357
3358
|
|
package/utils-studio.mjs
CHANGED
@@ -1100,7 +1100,7 @@ var init_outputs = __esm({
|
|
1100
1100
|
});
|
1101
1101
|
|
1102
1102
|
// src/serializer/sqliteSerializer.ts
|
1103
|
-
import { getTableName, is, SQL } from "drizzle-orm";
|
1103
|
+
import { getTableName, is, SQL as SQL2 } from "drizzle-orm";
|
1104
1104
|
import {
|
1105
1105
|
getTableConfig,
|
1106
1106
|
SQLiteBaseInteger,
|
@@ -1563,7 +1563,7 @@ import {
|
|
1563
1563
|
uniqueKeyName as uniqueKeyName2
|
1564
1564
|
} from "drizzle-orm/pg-core";
|
1565
1565
|
import { getTableConfig as getTableConfig2 } from "drizzle-orm/pg-core";
|
1566
|
-
import { is as is2, SQL as
|
1566
|
+
import { is as is2, SQL as SQL3, getTableName as getTableName2 } from "drizzle-orm";
|
1567
1567
|
var dialect2, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
1568
1568
|
var init_pgSerializer = __esm({
|
1569
1569
|
"src/serializer/pgSerializer.ts"() {
|
@@ -1640,7 +1640,7 @@ var init_pgSerializer = __esm({
|
|
1640
1640
|
END AS data_type, INFORMATION_SCHEMA.COLUMNS.table_name, INFORMATION_SCHEMA.COLUMNS.column_name, INFORMATION_SCHEMA.COLUMNS.column_default, INFORMATION_SCHEMA.COLUMNS.data_type as additional_dt
|
1641
1641
|
FROM pg_attribute a
|
1642
1642
|
JOIN INFORMATION_SCHEMA.COLUMNS ON INFORMATION_SCHEMA.COLUMNS.column_name = a.attname
|
1643
|
-
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}'
|
1643
|
+
WHERE a.attrelid = '"${tableSchema}"."${tableName}"'::regclass and INFORMATION_SCHEMA.COLUMNS.table_name = '${tableName}' and INFORMATION_SCHEMA.COLUMNS.table_schema = '${tableSchema}'
|
1644
1644
|
AND a.attnum > 0
|
1645
1645
|
AND NOT a.attisdropped
|
1646
1646
|
ORDER BY a.attnum;`
|
@@ -1980,7 +1980,7 @@ var init_pgSerializer = __esm({
|
|
1980
1980
|
});
|
1981
1981
|
|
1982
1982
|
// src/drivers/index.ts
|
1983
|
-
import { sql } from "drizzle-orm";
|
1983
|
+
import { sql as sql2 } from "drizzle-orm";
|
1984
1984
|
var DrizzleDbClient, DrizzleORMPgClient, TursoSqlite;
|
1985
1985
|
var init_drivers = __esm({
|
1986
1986
|
"src/drivers/index.ts"() {
|
@@ -1991,11 +1991,11 @@ var init_drivers = __esm({
|
|
1991
1991
|
};
|
1992
1992
|
DrizzleORMPgClient = class extends DrizzleDbClient {
|
1993
1993
|
async query(query, values) {
|
1994
|
-
const res = await this.db.execute(
|
1994
|
+
const res = await this.db.execute(sql2.raw(query));
|
1995
1995
|
return res.rows;
|
1996
1996
|
}
|
1997
1997
|
async run(query) {
|
1998
|
-
const res = await this.db.execute(
|
1998
|
+
const res = await this.db.execute(sql2.raw(query));
|
1999
1999
|
return res.rows;
|
2000
2000
|
}
|
2001
2001
|
};
|
@@ -2012,6 +2012,7 @@ var init_drivers = __esm({
|
|
2012
2012
|
});
|
2013
2013
|
|
2014
2014
|
// src/serializer/schemaToDrizzle.ts
|
2015
|
+
import { sql } from "drizzle-orm";
|
2015
2016
|
import {
|
2016
2017
|
customType,
|
2017
2018
|
PgBigInt53Builder,
|
@@ -2176,7 +2177,7 @@ var sqliteSchemaToDrizzle = (schema) => {
|
|
2176
2177
|
columnBuilder = columnBuilder.notNull();
|
2177
2178
|
}
|
2178
2179
|
if (c.default) {
|
2179
|
-
columnBuilder = columnBuilder.default(c.default);
|
2180
|
+
columnBuilder = columnBuilder.default(sql`${c.default}`);
|
2180
2181
|
}
|
2181
2182
|
if (c.primaryKey) {
|
2182
2183
|
columnBuilder = columnBuilder.primaryKey();
|
package/utils.d.ts
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
import { Dialect } from "./schemaValidator";
|
1
|
+
import type { Dialect } from "./schemaValidator";
|
2
2
|
import { NamedWithSchema } from "./cli/commands/migrate";
|
3
|
-
import { PgDatabase } from "drizzle-orm/pg-core";
|
4
|
-
import { PgSchema as PgSchemaKit } from "./serializer/pgSchema";
|
5
|
-
import { DbConnection } from ".";
|
6
3
|
export declare const assertV1OutFolder: (out: string, dialect: Dialect | "{dialect}") => void;
|
7
4
|
export type Journal = {
|
8
5
|
version: string;
|
@@ -22,7 +19,6 @@ export declare const prepareOutFolder: (out: string, dialect: Dialect) => {
|
|
22
19
|
snapshots: string[];
|
23
20
|
journal: any;
|
24
21
|
};
|
25
|
-
export declare const mapValues: <IN, OUT>(obj: Record<string, IN>, map: (input: IN) => OUT) => Record<string, OUT>;
|
26
22
|
export declare const validateWithReport: (snapshots: string[], dialect: Dialect) => {
|
27
23
|
malformed: string[];
|
28
24
|
nonLatest: string[];
|
@@ -201,13 +197,3 @@ export declare const statementsForDiffs: (in1: any, in2: any) => Promise<{
|
|
201
197
|
columns: {};
|
202
198
|
} | undefined;
|
203
199
|
}>;
|
204
|
-
export type DrizzleSnapshotJSON = PgSchemaKit;
|
205
|
-
export declare const generateDrizzleJson: (imports: Record<string, unknown>, prevId?: string) => PgSchemaKit;
|
206
|
-
export declare const generateMigration: (prev: DrizzleSnapshotJSON, cur: DrizzleSnapshotJSON) => Promise<string[]>;
|
207
|
-
export declare const pushSchema: (imports: Record<string, unknown>, db: PgDatabase<any>) => Promise<{
|
208
|
-
hasDataLoss: boolean;
|
209
|
-
warnings: string[];
|
210
|
-
statementsToExecute: string[];
|
211
|
-
apply: () => Promise<void>;
|
212
|
-
}>;
|
213
|
-
export declare const prepareFrom: (connection: DbConnection) => Promise<Record<string, any>>;
|