drizzle-kit 0.20.0-029419a → 0.20.0-13160ca
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/cli/commands/pgIntrospect.d.ts +1 -0
- package/cli/commands/sqliteIntrospect.d.ts +3 -3
- package/cli/utils.d.ts +11 -0
- package/cli/views.d.ts +2 -2
- package/drivers/index.d.ts +3 -3
- package/index.cjs +219 -154
- package/package.json +2 -2
- package/serializer/index.d.ts +4 -4
- package/serializer/pgSerializer.d.ts +4 -4
- package/serializer/sqliteSerializer.d.ts +2 -2
- package/serializer/studioUtils.d.ts +5 -1
- package/sqlite-introspect.d.ts +2 -2
- package/utils-studio.d.ts +3 -0
- package/utils-studio.js +377 -18
- package/utils.d.ts +2 -22
- package/utils.js +2391 -1637
package/index.cjs
CHANGED
|
@@ -4555,7 +4555,7 @@ var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, d
|
|
|
4555
4555
|
var init_mysqlSchema = __esm({
|
|
4556
4556
|
"src/serializer/mysqlSchema.ts"() {
|
|
4557
4557
|
init_global();
|
|
4558
|
-
|
|
4558
|
+
init_utils5();
|
|
4559
4559
|
init_lib();
|
|
4560
4560
|
index = objectType({
|
|
4561
4561
|
name: stringType(),
|
|
@@ -4835,7 +4835,7 @@ var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, ta
|
|
|
4835
4835
|
var init_pgSchema = __esm({
|
|
4836
4836
|
"src/serializer/pgSchema.ts"() {
|
|
4837
4837
|
init_global();
|
|
4838
|
-
|
|
4838
|
+
init_utils5();
|
|
4839
4839
|
init_lib();
|
|
4840
4840
|
indexV2 = objectType({
|
|
4841
4841
|
name: stringType(),
|
|
@@ -5193,7 +5193,7 @@ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dia
|
|
|
5193
5193
|
var init_sqliteSchema = __esm({
|
|
5194
5194
|
"src/serializer/sqliteSchema.ts"() {
|
|
5195
5195
|
init_global();
|
|
5196
|
-
|
|
5196
|
+
init_utils5();
|
|
5197
5197
|
init_lib();
|
|
5198
5198
|
index3 = objectType({
|
|
5199
5199
|
name: stringType(),
|
|
@@ -11376,9 +11376,6 @@ var init_utils = __esm({
|
|
|
11376
11376
|
readDrizzleConfig = async (configPath) => {
|
|
11377
11377
|
const defaultTsConfigExists = (0, import_fs.existsSync)((0, import_path.join)((0, import_path.resolve)("drizzle.config.ts")));
|
|
11378
11378
|
const defaultJsConfigExists = (0, import_fs.existsSync)((0, import_path.join)((0, import_path.resolve)("drizzle.config.js")));
|
|
11379
|
-
const defaultJsonConfigExists = (0, import_fs.existsSync)(
|
|
11380
|
-
(0, import_path.join)((0, import_path.resolve)("drizzle.config.json"))
|
|
11381
|
-
);
|
|
11382
11379
|
const defaultConfigPath = defaultTsConfigExists ? "drizzle.config.ts" : defaultJsConfigExists ? "drizzle.config.js" : "drizzle.config.json";
|
|
11383
11380
|
if (configPath) {
|
|
11384
11381
|
console.log(
|
|
@@ -12091,13 +12088,12 @@ __export(pgSerializer_exports, {
|
|
|
12091
12088
|
indexName: () => indexName2,
|
|
12092
12089
|
toDrizzle: () => toDrizzle
|
|
12093
12090
|
});
|
|
12094
|
-
var import_pg_core2, import_pg_core3, import_drizzle_orm5,
|
|
12091
|
+
var import_pg_core2, import_pg_core3, import_drizzle_orm5, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn, toDrizzle;
|
|
12095
12092
|
var init_pgSerializer = __esm({
|
|
12096
12093
|
"src/serializer/pgSerializer.ts"() {
|
|
12097
12094
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
|
12098
12095
|
import_pg_core3 = require("drizzle-orm/pg-core");
|
|
12099
12096
|
import_drizzle_orm5 = require("drizzle-orm");
|
|
12100
|
-
import_drizzle_orm6 = require("drizzle-orm");
|
|
12101
12097
|
init_serializer();
|
|
12102
12098
|
init_source();
|
|
12103
12099
|
init_outputs();
|
|
@@ -12228,7 +12224,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
12228
12224
|
const onDelete = fk4.onDelete;
|
|
12229
12225
|
const onUpdate = fk4.onUpdate;
|
|
12230
12226
|
const reference = fk4.reference();
|
|
12231
|
-
const tableTo = (0,
|
|
12227
|
+
const tableTo = (0, import_drizzle_orm5.getTableName)(reference.foreignTable);
|
|
12232
12228
|
const columnsFrom = reference.columns.map((it) => it.name);
|
|
12233
12229
|
const columnsTo = reference.foreignColumns.map((it) => it.name);
|
|
12234
12230
|
return {
|
|
@@ -12702,7 +12698,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
12702
12698
|
}
|
|
12703
12699
|
}
|
|
12704
12700
|
};
|
|
12705
|
-
toDrizzle = (schema4) => {
|
|
12701
|
+
toDrizzle = (schema4, schemaName) => {
|
|
12706
12702
|
const tables = {};
|
|
12707
12703
|
Object.values(schema4.tables).forEach((t) => {
|
|
12708
12704
|
const columns = {};
|
|
@@ -12776,17 +12772,31 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
12776
12772
|
}
|
|
12777
12773
|
columns[columnName] = columnBuilder;
|
|
12778
12774
|
});
|
|
12779
|
-
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
12784
|
-
|
|
12785
|
-
|
|
12786
|
-
|
|
12775
|
+
if (schemaName === "public") {
|
|
12776
|
+
tables[t.name] = (0, import_pg_core2.pgTable)(t.name, columns, (cb) => {
|
|
12777
|
+
const res = {};
|
|
12778
|
+
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
|
12779
|
+
const gh = cpk.columns.map((c) => cb[c]);
|
|
12780
|
+
res[cpk.name] = new import_pg_core2.PrimaryKeyBuilder(
|
|
12781
|
+
gh,
|
|
12782
|
+
cpk.name
|
|
12783
|
+
);
|
|
12784
|
+
});
|
|
12785
|
+
return res;
|
|
12787
12786
|
});
|
|
12788
|
-
|
|
12789
|
-
|
|
12787
|
+
} else {
|
|
12788
|
+
tables[t.name] = (0, import_pg_core2.pgSchema)(schemaName).table(t.name, columns, (cb) => {
|
|
12789
|
+
const res = {};
|
|
12790
|
+
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
|
12791
|
+
const gh = cpk.columns.map((c) => cb[c]);
|
|
12792
|
+
res[cpk.name] = new import_pg_core2.PrimaryKeyBuilder(
|
|
12793
|
+
gh,
|
|
12794
|
+
cpk.name
|
|
12795
|
+
);
|
|
12796
|
+
});
|
|
12797
|
+
return res;
|
|
12798
|
+
});
|
|
12799
|
+
}
|
|
12790
12800
|
});
|
|
12791
12801
|
return tables;
|
|
12792
12802
|
};
|
|
@@ -12798,11 +12808,11 @@ var sqliteImports_exports = {};
|
|
|
12798
12808
|
__export(sqliteImports_exports, {
|
|
12799
12809
|
prepareFromSqliteImports: () => prepareFromSqliteImports
|
|
12800
12810
|
});
|
|
12801
|
-
var import_sqlite_core,
|
|
12811
|
+
var import_sqlite_core, import_drizzle_orm6, prepareFromSqliteImports;
|
|
12802
12812
|
var init_sqliteImports = __esm({
|
|
12803
12813
|
"src/serializer/sqliteImports.ts"() {
|
|
12804
12814
|
import_sqlite_core = require("drizzle-orm/sqlite-core");
|
|
12805
|
-
|
|
12815
|
+
import_drizzle_orm6 = require("drizzle-orm");
|
|
12806
12816
|
init_utils();
|
|
12807
12817
|
prepareFromSqliteImports = async (imports) => {
|
|
12808
12818
|
const tables = [];
|
|
@@ -12813,7 +12823,7 @@ var init_sqliteImports = __esm({
|
|
|
12813
12823
|
const i0 = require(`${it}`);
|
|
12814
12824
|
const i0values = Object.values(i0);
|
|
12815
12825
|
i0values.forEach((t) => {
|
|
12816
|
-
if ((0,
|
|
12826
|
+
if ((0, import_drizzle_orm6.is)(t, import_sqlite_core.SQLiteTable)) {
|
|
12817
12827
|
tables.push(t);
|
|
12818
12828
|
}
|
|
12819
12829
|
});
|
|
@@ -12866,11 +12876,10 @@ function mapSqlToSqliteType(sqlType) {
|
|
|
12866
12876
|
return "numeric";
|
|
12867
12877
|
}
|
|
12868
12878
|
}
|
|
12869
|
-
var
|
|
12879
|
+
var import_drizzle_orm7, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3, toDrizzle2;
|
|
12870
12880
|
var init_sqliteSerializer = __esm({
|
|
12871
12881
|
"src/serializer/sqliteSerializer.ts"() {
|
|
12872
|
-
|
|
12873
|
-
import_drizzle_orm9 = require("drizzle-orm");
|
|
12882
|
+
import_drizzle_orm7 = require("drizzle-orm");
|
|
12874
12883
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
|
12875
12884
|
init_serializer();
|
|
12876
12885
|
init_outputs();
|
|
@@ -12900,10 +12909,10 @@ var init_sqliteSerializer = __esm({
|
|
|
12900
12909
|
type: column7.getSQLType(),
|
|
12901
12910
|
primaryKey,
|
|
12902
12911
|
notNull,
|
|
12903
|
-
autoincrement: (0,
|
|
12912
|
+
autoincrement: (0, import_drizzle_orm7.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false
|
|
12904
12913
|
};
|
|
12905
12914
|
if (column7.default !== void 0) {
|
|
12906
|
-
if ((0,
|
|
12915
|
+
if ((0, import_drizzle_orm7.is)(column7.default, import_drizzle_orm7.SQL)) {
|
|
12907
12916
|
columnToSet.default = sqlToStr(column7.default);
|
|
12908
12917
|
} else {
|
|
12909
12918
|
columnToSet.default = typeof column7.default === "string" ? `'${column7.default}'` : column7.default;
|
|
@@ -12943,7 +12952,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
12943
12952
|
const onUpdate = fk4.onUpdate ?? "no action";
|
|
12944
12953
|
const reference = fk4.reference();
|
|
12945
12954
|
const referenceFT = reference.foreignTable;
|
|
12946
|
-
const tableTo = (0,
|
|
12955
|
+
const tableTo = (0, import_drizzle_orm7.getTableName)(referenceFT);
|
|
12947
12956
|
const columnsFrom = reference.columns.map((it) => it.name);
|
|
12948
12957
|
const columnsTo = reference.foreignColumns.map((it) => it.name);
|
|
12949
12958
|
return {
|
|
@@ -12963,7 +12972,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
12963
12972
|
const columns2 = value.config.columns;
|
|
12964
12973
|
const name = value.config.name;
|
|
12965
12974
|
let indexColumns = columns2.map((it) => {
|
|
12966
|
-
if ((0,
|
|
12975
|
+
if ((0, import_drizzle_orm7.is)(it, import_drizzle_orm7.SQL)) {
|
|
12967
12976
|
return dialect5.sqlToQuery(it).sql;
|
|
12968
12977
|
} else {
|
|
12969
12978
|
return it.name;
|
|
@@ -12971,7 +12980,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
|
12971
12980
|
});
|
|
12972
12981
|
let where = void 0;
|
|
12973
12982
|
if (value.config.where !== void 0) {
|
|
12974
|
-
if ((0,
|
|
12983
|
+
if ((0, import_drizzle_orm7.is)(value.config.where, import_drizzle_orm7.SQL)) {
|
|
12975
12984
|
where = dialect5.sqlToQuery(value.config.where).sql;
|
|
12976
12985
|
}
|
|
12977
12986
|
}
|
|
@@ -13269,7 +13278,10 @@ WHERE
|
|
|
13269
13278
|
const res = {};
|
|
13270
13279
|
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
|
13271
13280
|
const gh = cpk.columns.map((c) => cb[c]);
|
|
13272
|
-
res[cpk.name] = new import_sqlite_core2.PrimaryKeyBuilder(
|
|
13281
|
+
res[cpk.name] = new import_sqlite_core2.PrimaryKeyBuilder(
|
|
13282
|
+
gh,
|
|
13283
|
+
cpk.name
|
|
13284
|
+
);
|
|
13273
13285
|
});
|
|
13274
13286
|
return res;
|
|
13275
13287
|
});
|
|
@@ -13289,13 +13301,13 @@ var init_serializer = __esm({
|
|
|
13289
13301
|
init_source();
|
|
13290
13302
|
sqlToStr = (sql2) => {
|
|
13291
13303
|
return sql2.toQuery({
|
|
13292
|
-
escapeName: (
|
|
13304
|
+
escapeName: () => {
|
|
13293
13305
|
throw new Error("we don't support params for `sql` default values");
|
|
13294
13306
|
},
|
|
13295
|
-
escapeParam: (
|
|
13307
|
+
escapeParam: () => {
|
|
13296
13308
|
throw new Error("we don't support params for `sql` default values");
|
|
13297
13309
|
},
|
|
13298
|
-
escapeString: (
|
|
13310
|
+
escapeString: () => {
|
|
13299
13311
|
throw new Error("we don't support params for `sql` default values");
|
|
13300
13312
|
}
|
|
13301
13313
|
}).sql;
|
|
@@ -14800,7 +14812,7 @@ var init_migrate = __esm({
|
|
|
14800
14812
|
init_pgSchema();
|
|
14801
14813
|
init_sqliteSchema();
|
|
14802
14814
|
init_mysqlSchema();
|
|
14803
|
-
|
|
14815
|
+
init_utils5();
|
|
14804
14816
|
init_words();
|
|
14805
14817
|
init_outputs();
|
|
14806
14818
|
prepareAndMigratePg = async (config) => {
|
|
@@ -17174,7 +17186,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
17174
17186
|
init_lib();
|
|
17175
17187
|
init_jsonDiffer();
|
|
17176
17188
|
init_jsonStatements();
|
|
17177
|
-
|
|
17189
|
+
init_utils5();
|
|
17178
17190
|
init_sqliteSchema();
|
|
17179
17191
|
init_mysqlSchema();
|
|
17180
17192
|
makeChanged = (schema4) => {
|
|
@@ -17796,7 +17808,7 @@ var init_pgUp = __esm({
|
|
|
17796
17808
|
import_fs5 = require("fs");
|
|
17797
17809
|
init_global();
|
|
17798
17810
|
init_pgSchema();
|
|
17799
|
-
|
|
17811
|
+
init_utils5();
|
|
17800
17812
|
upPgHandlerV4toV5 = (obj) => {
|
|
17801
17813
|
const mappedTables = {};
|
|
17802
17814
|
for (const [key, table4] of Object.entries(obj.tables)) {
|
|
@@ -18033,7 +18045,7 @@ var init_mysqlUp = __esm({
|
|
|
18033
18045
|
init_source();
|
|
18034
18046
|
import_fs6 = __toESM(require("fs"));
|
|
18035
18047
|
init_mysqlSchema();
|
|
18036
|
-
|
|
18048
|
+
init_utils5();
|
|
18037
18049
|
upMysqlHandler = (out) => {
|
|
18038
18050
|
};
|
|
18039
18051
|
upMySqlHandlerV4toV5 = (obj) => {
|
|
@@ -18146,7 +18158,7 @@ var init_upFolders = __esm({
|
|
|
18146
18158
|
init_mysqlSchema();
|
|
18147
18159
|
init_sqliteSchema();
|
|
18148
18160
|
init_snapshotsDiffer();
|
|
18149
|
-
|
|
18161
|
+
init_utils5();
|
|
18150
18162
|
init_words();
|
|
18151
18163
|
init_pgUp();
|
|
18152
18164
|
init_pgSchema();
|
|
@@ -25178,15 +25190,33 @@ var require_lib2 = __commonJS({
|
|
|
25178
25190
|
});
|
|
25179
25191
|
|
|
25180
25192
|
// src/drivers/index.ts
|
|
25181
|
-
var
|
|
25193
|
+
var drivers_exports = {};
|
|
25194
|
+
__export(drivers_exports, {
|
|
25195
|
+
BetterSqlite: () => BetterSqlite,
|
|
25196
|
+
DrizzleDbClient: () => DrizzleDbClient,
|
|
25197
|
+
DrizzleORMPgClient: () => DrizzleORMPgClient,
|
|
25198
|
+
PgPostgres: () => PgPostgres,
|
|
25199
|
+
TursoSqlite: () => TursoSqlite
|
|
25200
|
+
});
|
|
25201
|
+
var import_drizzle_orm8, DrizzleDbClient, DrizzleORMPgClient, BetterSqlite, TursoSqlite, PgPostgres;
|
|
25182
25202
|
var init_drivers = __esm({
|
|
25183
25203
|
"src/drivers/index.ts"() {
|
|
25184
|
-
|
|
25204
|
+
import_drizzle_orm8 = require("drizzle-orm");
|
|
25185
25205
|
DrizzleDbClient = class {
|
|
25186
25206
|
constructor(db) {
|
|
25187
25207
|
this.db = db;
|
|
25188
25208
|
}
|
|
25189
25209
|
};
|
|
25210
|
+
DrizzleORMPgClient = class extends DrizzleDbClient {
|
|
25211
|
+
async query(query, values) {
|
|
25212
|
+
const res = await this.db.execute(import_drizzle_orm8.sql.raw(query));
|
|
25213
|
+
return res.rows;
|
|
25214
|
+
}
|
|
25215
|
+
async run(query) {
|
|
25216
|
+
const res = await this.db.execute(import_drizzle_orm8.sql.raw(query));
|
|
25217
|
+
return res.rows;
|
|
25218
|
+
}
|
|
25219
|
+
};
|
|
25190
25220
|
BetterSqlite = class extends DrizzleDbClient {
|
|
25191
25221
|
async run(query) {
|
|
25192
25222
|
this.db.prepare(query).run();
|
|
@@ -25243,9 +25273,10 @@ var init_pgConnect = __esm({
|
|
|
25243
25273
|
var pgIntrospect_exports = {};
|
|
25244
25274
|
__export(pgIntrospect_exports, {
|
|
25245
25275
|
pgIntrospect: () => pgIntrospect,
|
|
25246
|
-
pgPushIntrospect: () => pgPushIntrospect
|
|
25276
|
+
pgPushIntrospect: () => pgPushIntrospect,
|
|
25277
|
+
pgSchemas: () => pgSchemas
|
|
25247
25278
|
});
|
|
25248
|
-
var import_hanji4, pgPushIntrospect, pgIntrospect;
|
|
25279
|
+
var import_hanji4, pgSchemas, pgPushIntrospect, pgIntrospect;
|
|
25249
25280
|
var init_pgIntrospect = __esm({
|
|
25250
25281
|
"src/cli/commands/pgIntrospect.ts"() {
|
|
25251
25282
|
import_hanji4 = __toESM(require_hanji());
|
|
@@ -25254,6 +25285,18 @@ var init_pgIntrospect = __esm({
|
|
|
25254
25285
|
init_introspect();
|
|
25255
25286
|
init_global();
|
|
25256
25287
|
init_mjs();
|
|
25288
|
+
pgSchemas = async (client) => {
|
|
25289
|
+
const res = await client.query(`select s.nspname as table_schema,
|
|
25290
|
+
s.oid as schema_id,
|
|
25291
|
+
u.usename as owner
|
|
25292
|
+
from pg_catalog.pg_namespace s
|
|
25293
|
+
join pg_catalog.pg_user u on u.usesysid = s.nspowner
|
|
25294
|
+
where nspname not in ('information_schema', 'pg_catalog')
|
|
25295
|
+
and nspname not like 'pg_toast%'
|
|
25296
|
+
and nspname not like 'pg_temp_%'
|
|
25297
|
+
order by table_schema;`);
|
|
25298
|
+
return res.map((it) => it["table_schema"]);
|
|
25299
|
+
};
|
|
25257
25300
|
pgPushIntrospect = async (connection, filters, schemaFilters) => {
|
|
25258
25301
|
const { client } = connection;
|
|
25259
25302
|
const matchers = filters.map((it) => {
|
|
@@ -25871,18 +25914,18 @@ var init_sqliteIntrospect = __esm({
|
|
|
25871
25914
|
init_sqlite_introspect();
|
|
25872
25915
|
init_mjs();
|
|
25873
25916
|
import_hanji7 = __toESM(require_hanji());
|
|
25874
|
-
init_drivers();
|
|
25875
25917
|
connectToSQLite = async (config) => {
|
|
25918
|
+
const { BetterSqlite: BetterSqlite2, TursoSqlite: TursoSqlite2 } = await Promise.resolve().then(() => (init_drivers(), drivers_exports));
|
|
25876
25919
|
if (config.driver === "better-sqlite") {
|
|
25877
25920
|
const { default: Database } = await import("better-sqlite3");
|
|
25878
25921
|
return {
|
|
25879
|
-
client: new
|
|
25922
|
+
client: new BetterSqlite2(new Database(config.dbCredentials.url))
|
|
25880
25923
|
};
|
|
25881
25924
|
}
|
|
25882
25925
|
if (config.driver === "libsql") {
|
|
25883
25926
|
const { createClient } = await import("@libsql/client");
|
|
25884
25927
|
return {
|
|
25885
|
-
client: new
|
|
25928
|
+
client: new TursoSqlite2(
|
|
25886
25929
|
createClient({
|
|
25887
25930
|
url: config.dbCredentials.url
|
|
25888
25931
|
})
|
|
@@ -25891,7 +25934,7 @@ var init_sqliteIntrospect = __esm({
|
|
|
25891
25934
|
} else {
|
|
25892
25935
|
const { createClient } = await import("@libsql/client");
|
|
25893
25936
|
return {
|
|
25894
|
-
client: new
|
|
25937
|
+
client: new TursoSqlite2(
|
|
25895
25938
|
createClient({
|
|
25896
25939
|
url: config.dbCredentials.url,
|
|
25897
25940
|
authToken: config.dbCredentials.authToken
|
|
@@ -25919,13 +25962,9 @@ var init_sqliteIntrospect = __esm({
|
|
|
25919
25962
|
const progress = new IntrospectProgress();
|
|
25920
25963
|
const res = await (0, import_hanji7.renderWithTask)(
|
|
25921
25964
|
progress,
|
|
25922
|
-
fromDatabase3(
|
|
25923
|
-
|
|
25924
|
-
|
|
25925
|
-
(stage, count, status) => {
|
|
25926
|
-
progress.update(stage, count, status);
|
|
25927
|
-
}
|
|
25928
|
-
)
|
|
25965
|
+
fromDatabase3(client, filter2, (stage, count, status) => {
|
|
25966
|
+
progress.update(stage, count, status);
|
|
25967
|
+
})
|
|
25929
25968
|
);
|
|
25930
25969
|
const schema4 = { id: originUUID, prevId: "", ...res };
|
|
25931
25970
|
const ts = schemaToTypeScript2(schema4, config.introspect.casing);
|
|
@@ -25952,6 +25991,59 @@ var init_sqliteIntrospect = __esm({
|
|
|
25952
25991
|
}
|
|
25953
25992
|
});
|
|
25954
25993
|
|
|
25994
|
+
// src/cli/utils.ts
|
|
25995
|
+
var assertExists, assertPackages, requiredApiVersion, assertOrmCoreVersion, ormCoreVersions;
|
|
25996
|
+
var init_utils3 = __esm({
|
|
25997
|
+
"src/cli/utils.ts"() {
|
|
25998
|
+
init_views();
|
|
25999
|
+
assertExists = (it) => {
|
|
26000
|
+
if (!it)
|
|
26001
|
+
throw new Error();
|
|
26002
|
+
};
|
|
26003
|
+
assertPackages = async (...pkgs) => {
|
|
26004
|
+
try {
|
|
26005
|
+
for (let i = 0; i < pkgs.length; i++) {
|
|
26006
|
+
const it = pkgs[i];
|
|
26007
|
+
await import(it);
|
|
26008
|
+
}
|
|
26009
|
+
} catch (e) {
|
|
26010
|
+
err(
|
|
26011
|
+
`please install required packages: ${pkgs.map((it) => `'${it}'`).join(" ")}`
|
|
26012
|
+
);
|
|
26013
|
+
process.exit(1);
|
|
26014
|
+
}
|
|
26015
|
+
};
|
|
26016
|
+
requiredApiVersion = 5;
|
|
26017
|
+
assertOrmCoreVersion = async () => {
|
|
26018
|
+
try {
|
|
26019
|
+
const { compatibilityVersion } = await import("drizzle-orm/version");
|
|
26020
|
+
if (compatibilityVersion && compatibilityVersion === requiredApiVersion)
|
|
26021
|
+
return;
|
|
26022
|
+
if (!compatibilityVersion || compatibilityVersion < requiredApiVersion) {
|
|
26023
|
+
console.log(
|
|
26024
|
+
"This version of drizzle-kit requires newer version of drizzle-orm\nPlease update drizzle-orm package to the latest version \u{1F44D}"
|
|
26025
|
+
);
|
|
26026
|
+
} else {
|
|
26027
|
+
console.log(
|
|
26028
|
+
"This version of drizzle-kit is outdated\nPlease update drizzle-kit package to the latest version \u{1F44D}"
|
|
26029
|
+
);
|
|
26030
|
+
}
|
|
26031
|
+
} catch (e) {
|
|
26032
|
+
console.log("Please install latest version of drizzle-orm");
|
|
26033
|
+
}
|
|
26034
|
+
process.exit(1);
|
|
26035
|
+
};
|
|
26036
|
+
ormCoreVersions = async () => {
|
|
26037
|
+
try {
|
|
26038
|
+
const { compatibilityVersion, npmVersion } = await import("drizzle-orm/version");
|
|
26039
|
+
return { compatibilityVersion, npmVersion };
|
|
26040
|
+
} catch (e) {
|
|
26041
|
+
return {};
|
|
26042
|
+
}
|
|
26043
|
+
};
|
|
26044
|
+
}
|
|
26045
|
+
});
|
|
26046
|
+
|
|
25955
26047
|
// node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/lib/SqlString.js
|
|
25956
26048
|
var require_SqlString = __commonJS({
|
|
25957
26049
|
"node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/lib/SqlString.js"(exports) {
|
|
@@ -41926,7 +42018,7 @@ var require_server = __commonJS({
|
|
|
41926
42018
|
var EventEmitter = require("events").EventEmitter;
|
|
41927
42019
|
var Connection2 = require_connection2();
|
|
41928
42020
|
var ConnectionConfig = require_connection_config();
|
|
41929
|
-
var
|
|
42021
|
+
var Server2 = class extends EventEmitter {
|
|
41930
42022
|
constructor() {
|
|
41931
42023
|
super();
|
|
41932
42024
|
this.connections = [];
|
|
@@ -41949,7 +42041,7 @@ var require_server = __commonJS({
|
|
|
41949
42041
|
this._server.close(cb);
|
|
41950
42042
|
}
|
|
41951
42043
|
};
|
|
41952
|
-
module2.exports =
|
|
42044
|
+
module2.exports = Server2;
|
|
41953
42045
|
}
|
|
41954
42046
|
});
|
|
41955
42047
|
|
|
@@ -41980,8 +42072,8 @@ var require_mysql2 = __commonJS({
|
|
|
41980
42072
|
exports.Pool = Pool;
|
|
41981
42073
|
exports.PoolCluster = PoolCluster;
|
|
41982
42074
|
exports.createServer = function(handler) {
|
|
41983
|
-
const
|
|
41984
|
-
const s = new
|
|
42075
|
+
const Server2 = require_server();
|
|
42076
|
+
const s = new Server2();
|
|
41985
42077
|
if (handler) {
|
|
41986
42078
|
s.on("connection", handler);
|
|
41987
42079
|
}
|
|
@@ -42507,14 +42599,14 @@ var require_promise = __commonJS({
|
|
|
42507
42599
|
});
|
|
42508
42600
|
|
|
42509
42601
|
// src/orm-extenstions/d1-driver/session.ts
|
|
42510
|
-
var
|
|
42602
|
+
var import_drizzle_orm9, import_drizzle_orm10, import_drizzle_orm11, import_sqlite_core3, import_drizzle_orm12, _a, SQLiteWranglerD1Session, _a2, PreparedQuery;
|
|
42511
42603
|
var init_session = __esm({
|
|
42512
42604
|
"src/orm-extenstions/d1-driver/session.ts"() {
|
|
42605
|
+
import_drizzle_orm9 = require("drizzle-orm");
|
|
42606
|
+
import_drizzle_orm10 = require("drizzle-orm");
|
|
42513
42607
|
import_drizzle_orm11 = require("drizzle-orm");
|
|
42514
|
-
import_drizzle_orm12 = require("drizzle-orm");
|
|
42515
|
-
import_drizzle_orm13 = require("drizzle-orm");
|
|
42516
42608
|
import_sqlite_core3 = require("drizzle-orm/sqlite-core");
|
|
42517
|
-
|
|
42609
|
+
import_drizzle_orm12 = require("drizzle-orm");
|
|
42518
42610
|
SQLiteWranglerD1Session = class extends import_sqlite_core3.SQLiteSession {
|
|
42519
42611
|
constructor(client, configPath, dbName, dialect6, schema4, options = {}) {
|
|
42520
42612
|
super(dialect6);
|
|
@@ -42523,7 +42615,7 @@ var init_session = __esm({
|
|
|
42523
42615
|
this.dbName = dbName;
|
|
42524
42616
|
this.schema = schema4;
|
|
42525
42617
|
this.options = options;
|
|
42526
|
-
this.logger = options.logger ?? new
|
|
42618
|
+
this.logger = options.logger ?? new import_drizzle_orm10.NoopLogger();
|
|
42527
42619
|
}
|
|
42528
42620
|
prepareQuery(query, fields, executeMethod, customResultMapper) {
|
|
42529
42621
|
return new PreparedQuery(
|
|
@@ -42542,7 +42634,7 @@ var init_session = __esm({
|
|
|
42542
42634
|
throw new Error("no transaction support yet");
|
|
42543
42635
|
}
|
|
42544
42636
|
};
|
|
42545
|
-
_a =
|
|
42637
|
+
_a = import_drizzle_orm9.entityKind;
|
|
42546
42638
|
SQLiteWranglerD1Session[_a] = "SQLiteD1Session";
|
|
42547
42639
|
PreparedQuery = class extends import_sqlite_core3.PreparedQuery {
|
|
42548
42640
|
constructor(stmt, configPath, dbName, queryString, params, logger, fields, executeMethod, customResultMapper) {
|
|
@@ -42557,14 +42649,14 @@ var init_session = __esm({
|
|
|
42557
42649
|
this.customResultMapper = customResultMapper;
|
|
42558
42650
|
}
|
|
42559
42651
|
run(placeholderValues) {
|
|
42560
|
-
const params = (0,
|
|
42652
|
+
const params = (0, import_drizzle_orm11.fillPlaceholders)(this.params, placeholderValues ?? {});
|
|
42561
42653
|
this.logger.logQuery(this.queryString, params);
|
|
42562
42654
|
return this.stmt(this.queryString, this.configPath, this.dbName);
|
|
42563
42655
|
}
|
|
42564
42656
|
async all(placeholderValues) {
|
|
42565
42657
|
const { fields, queryString, logger, stmt, customResultMapper } = this;
|
|
42566
42658
|
if (!fields && !customResultMapper) {
|
|
42567
|
-
const params = (0,
|
|
42659
|
+
const params = (0, import_drizzle_orm11.fillPlaceholders)(this.params, placeholderValues ?? {});
|
|
42568
42660
|
logger.logQuery(queryString, params);
|
|
42569
42661
|
return stmt(this.queryString, this.configPath, this.dbName).then(
|
|
42570
42662
|
({ results }) => results
|
|
@@ -42574,12 +42666,12 @@ var init_session = __esm({
|
|
|
42574
42666
|
if (customResultMapper) {
|
|
42575
42667
|
return customResultMapper(rows);
|
|
42576
42668
|
}
|
|
42577
|
-
return rows.map((row) => (0,
|
|
42669
|
+
return rows.map((row) => (0, import_drizzle_orm12.mapResultRow)(fields, row, void 0));
|
|
42578
42670
|
}
|
|
42579
42671
|
async get(placeholderValues) {
|
|
42580
42672
|
const { fields, queryString, logger, stmt, customResultMapper } = this;
|
|
42581
42673
|
if (!fields && !customResultMapper) {
|
|
42582
|
-
const params = (0,
|
|
42674
|
+
const params = (0, import_drizzle_orm11.fillPlaceholders)(this.params, placeholderValues ?? {});
|
|
42583
42675
|
logger.logQuery(queryString, params);
|
|
42584
42676
|
return stmt(queryString, this.configPath, this.dbName).then(
|
|
42585
42677
|
({ results }) => results[0]
|
|
@@ -42603,13 +42695,13 @@ var init_session = __esm({
|
|
|
42603
42695
|
return rows;
|
|
42604
42696
|
}
|
|
42605
42697
|
async values(placeholderValues) {
|
|
42606
|
-
const params = (0,
|
|
42698
|
+
const params = (0, import_drizzle_orm11.fillPlaceholders)(this.params, placeholderValues ?? {});
|
|
42607
42699
|
this.logger.logQuery(this.queryString, params);
|
|
42608
42700
|
const wranglerRes = await this.stmt(this.queryString, this.configPath, this.dbName);
|
|
42609
42701
|
return this.d1ToRawMapping(wranglerRes.results);
|
|
42610
42702
|
}
|
|
42611
42703
|
};
|
|
42612
|
-
_a2 =
|
|
42704
|
+
_a2 = import_drizzle_orm9.entityKind;
|
|
42613
42705
|
PreparedQuery[_a2] = "D1PreparedQuery";
|
|
42614
42706
|
}
|
|
42615
42707
|
});
|
|
@@ -42643,15 +42735,15 @@ function drizzle(client, configPath, dbName, config = {}) {
|
|
|
42643
42735
|
const dialect6 = new WranglerDialect();
|
|
42644
42736
|
let logger;
|
|
42645
42737
|
if (config.logger === true) {
|
|
42646
|
-
logger = new
|
|
42738
|
+
logger = new import_drizzle_orm13.DefaultLogger();
|
|
42647
42739
|
} else if (config.logger !== false) {
|
|
42648
42740
|
logger = config.logger;
|
|
42649
42741
|
}
|
|
42650
42742
|
let schema4;
|
|
42651
42743
|
if (config.schema) {
|
|
42652
|
-
const tablesConfig = (0,
|
|
42744
|
+
const tablesConfig = (0, import_drizzle_orm13.extractTablesRelationalConfig)(
|
|
42653
42745
|
config.schema,
|
|
42654
|
-
|
|
42746
|
+
import_drizzle_orm13.createTableRelationsHelpers
|
|
42655
42747
|
);
|
|
42656
42748
|
schema4 = {
|
|
42657
42749
|
fullSchema: config.schema,
|
|
@@ -42669,10 +42761,10 @@ function drizzle(client, configPath, dbName, config = {}) {
|
|
|
42669
42761
|
schema4
|
|
42670
42762
|
);
|
|
42671
42763
|
}
|
|
42672
|
-
var
|
|
42764
|
+
var import_drizzle_orm13, import_sqlite_core4, WranglerDialect;
|
|
42673
42765
|
var init_driver = __esm({
|
|
42674
42766
|
"src/orm-extenstions/d1-driver/driver.ts"() {
|
|
42675
|
-
|
|
42767
|
+
import_drizzle_orm13 = require("drizzle-orm");
|
|
42676
42768
|
import_sqlite_core4 = require("drizzle-orm/sqlite-core");
|
|
42677
42769
|
init_session();
|
|
42678
42770
|
WranglerDialect = class extends import_sqlite_core4.SQLiteAsyncDialect {
|
|
@@ -57917,7 +58009,7 @@ var require_dist2 = __commonJS({
|
|
|
57917
58009
|
});
|
|
57918
58010
|
|
|
57919
58011
|
// node_modules/.pnpm/webpod@0.0.2/node_modules/webpod/dist/utils.js
|
|
57920
|
-
var
|
|
58012
|
+
var init_utils4 = __esm({
|
|
57921
58013
|
"node_modules/.pnpm/webpod@0.0.2/node_modules/webpod/dist/utils.js"() {
|
|
57922
58014
|
}
|
|
57923
58015
|
});
|
|
@@ -57925,7 +58017,7 @@ var init_utils3 = __esm({
|
|
|
57925
58017
|
// node_modules/.pnpm/webpod@0.0.2/node_modules/webpod/dist/ssh.js
|
|
57926
58018
|
var init_ssh = __esm({
|
|
57927
58019
|
"node_modules/.pnpm/webpod@0.0.2/node_modules/webpod/dist/ssh.js"() {
|
|
57928
|
-
|
|
58020
|
+
init_utils4();
|
|
57929
58021
|
}
|
|
57930
58022
|
});
|
|
57931
58023
|
|
|
@@ -57985,21 +58077,23 @@ var init_wrangler_client = __esm({
|
|
|
57985
58077
|
var studioUtils_exports = {};
|
|
57986
58078
|
__export(studioUtils_exports, {
|
|
57987
58079
|
drizzleDb: () => drizzleDb,
|
|
58080
|
+
drizzleForPostgres: () => drizzleForPostgres,
|
|
57988
58081
|
prepareModels: () => prepareModels
|
|
57989
58082
|
});
|
|
57990
|
-
var
|
|
58083
|
+
var import_drizzle_orm14, import_mysql_core4, import_pg_core4, import_sqlite_core5, prepareModels, drizzleForPostgres, drizzleDb;
|
|
57991
58084
|
var init_studioUtils = __esm({
|
|
57992
58085
|
"src/serializer/studioUtils.ts"() {
|
|
57993
|
-
|
|
58086
|
+
import_drizzle_orm14 = require("drizzle-orm");
|
|
57994
58087
|
import_mysql_core4 = require("drizzle-orm/mysql-core");
|
|
57995
58088
|
import_pg_core4 = require("drizzle-orm/pg-core");
|
|
57996
58089
|
import_sqlite_core5 = require("drizzle-orm/sqlite-core");
|
|
57997
58090
|
init_utils();
|
|
58091
|
+
init_utils3();
|
|
57998
58092
|
init_serializer();
|
|
57999
58093
|
prepareModels = async (path4) => {
|
|
58000
58094
|
const imports = prepareFilenames(path4);
|
|
58001
58095
|
const sqliteSchema2 = {};
|
|
58002
|
-
const
|
|
58096
|
+
const pgSchema4 = {};
|
|
58003
58097
|
const mysqlSchema4 = {};
|
|
58004
58098
|
const { unregister } = await safeRegister();
|
|
58005
58099
|
for (let i = 0; i < imports.length; i++) {
|
|
@@ -58007,33 +58101,45 @@ var init_studioUtils = __esm({
|
|
|
58007
58101
|
const i0 = require(`${it}`);
|
|
58008
58102
|
const i0values = Object.entries(i0);
|
|
58009
58103
|
i0values.forEach(([k, t]) => {
|
|
58010
|
-
if ((0,
|
|
58011
|
-
|
|
58104
|
+
if ((0, import_drizzle_orm14.is)(t, import_pg_core4.PgTable)) {
|
|
58105
|
+
pgSchema4[k] = t;
|
|
58012
58106
|
}
|
|
58013
|
-
if ((0,
|
|
58107
|
+
if ((0, import_drizzle_orm14.is)(t, import_mysql_core4.MySqlTable)) {
|
|
58014
58108
|
mysqlSchema4[k] = t;
|
|
58015
58109
|
}
|
|
58016
|
-
if ((0,
|
|
58110
|
+
if ((0, import_drizzle_orm14.is)(t, import_sqlite_core5.SQLiteTable)) {
|
|
58017
58111
|
sqliteSchema2[k] = t;
|
|
58018
58112
|
}
|
|
58019
|
-
if ((0,
|
|
58113
|
+
if ((0, import_drizzle_orm14.is)(t, import_drizzle_orm14.Relations)) {
|
|
58020
58114
|
sqliteSchema2[k] = t;
|
|
58021
|
-
|
|
58115
|
+
pgSchema4[k] = t;
|
|
58022
58116
|
mysqlSchema4[k] = t;
|
|
58023
58117
|
}
|
|
58024
58118
|
});
|
|
58025
58119
|
}
|
|
58026
58120
|
unregister();
|
|
58027
|
-
return { pgSchema:
|
|
58121
|
+
return { pgSchema: pgSchema4, mysqlSchema: mysqlSchema4, sqliteSchema: sqliteSchema2 };
|
|
58122
|
+
};
|
|
58123
|
+
drizzleForPostgres = async (connectionConfig, pgSchema4, verbose) => {
|
|
58124
|
+
assertPackages("pg");
|
|
58125
|
+
const { drizzle: drizzle2 } = await import("drizzle-orm/node-postgres");
|
|
58126
|
+
const { Pool } = await Promise.resolve().then(() => __toESM(require_lib2()));
|
|
58127
|
+
const db = drizzle2(new Pool(connectionConfig.dbCredentials), {
|
|
58128
|
+
logger: verbose
|
|
58129
|
+
});
|
|
58130
|
+
return {
|
|
58131
|
+
type: "pg",
|
|
58132
|
+
db,
|
|
58133
|
+
schema: pgSchema4
|
|
58134
|
+
};
|
|
58028
58135
|
};
|
|
58029
|
-
drizzleDb = async (drizzleConfig, models, logger) => {
|
|
58136
|
+
drizzleDb = async (drizzleConfig, models, logger, pgClient) => {
|
|
58030
58137
|
if (drizzleConfig.driver === "pg") {
|
|
58031
58138
|
const { drizzle: drizzle2 } = await import("drizzle-orm/node-postgres");
|
|
58032
|
-
|
|
58033
|
-
|
|
58034
|
-
types.setTypeParser(types.builtins.INTERVAL, (val) => val);
|
|
58139
|
+
if (!pgClient)
|
|
58140
|
+
throw new Error("pg client not provided");
|
|
58035
58141
|
return {
|
|
58036
|
-
db: drizzle2(
|
|
58142
|
+
db: drizzle2(pgClient, { logger }),
|
|
58037
58143
|
type: "pg",
|
|
58038
58144
|
schema: models.pgSchema
|
|
58039
58145
|
};
|
|
@@ -58094,7 +58200,7 @@ var init_studioUtils = __esm({
|
|
|
58094
58200
|
|
|
58095
58201
|
// src/utils.ts
|
|
58096
58202
|
var import_fs8, import_path5, assertV1OutFolder, dryJournal, snapshotsPriorV4, prepareOutFolder2, mapValues, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
|
58097
|
-
var
|
|
58203
|
+
var init_utils5 = __esm({
|
|
58098
58204
|
"src/utils.ts"() {
|
|
58099
58205
|
import_fs8 = require("fs");
|
|
58100
58206
|
init_views();
|
|
@@ -59752,7 +59858,7 @@ var import_fs11 = require("fs");
|
|
|
59752
59858
|
init_lib();
|
|
59753
59859
|
|
|
59754
59860
|
// src/cli/commands/check.ts
|
|
59755
|
-
|
|
59861
|
+
init_utils5();
|
|
59756
59862
|
var checkHandler = (out, dialect6) => {
|
|
59757
59863
|
const { snapshots } = prepareOutFolder2(out, dialect6);
|
|
59758
59864
|
const report = validateWithReport(snapshots, dialect6);
|
|
@@ -59791,54 +59897,7 @@ var checkHandler = (out, dialect6) => {
|
|
|
59791
59897
|
// src/cli/index.ts
|
|
59792
59898
|
var import_hanji11 = __toESM(require_hanji());
|
|
59793
59899
|
var import_path7 = __toESM(require("path"));
|
|
59794
|
-
|
|
59795
|
-
// src/cli/utils.ts
|
|
59796
|
-
init_views();
|
|
59797
|
-
var assertPackages = async (...pkgs) => {
|
|
59798
|
-
try {
|
|
59799
|
-
for (let i = 0; i < pkgs.length; i++) {
|
|
59800
|
-
const it = pkgs[i];
|
|
59801
|
-
await import(it);
|
|
59802
|
-
}
|
|
59803
|
-
} catch (e) {
|
|
59804
|
-
err(
|
|
59805
|
-
`please install required packages: ${pkgs.map((it) => `'${it}'`).join(" ")}`
|
|
59806
|
-
);
|
|
59807
|
-
process.exit(1);
|
|
59808
|
-
}
|
|
59809
|
-
};
|
|
59810
|
-
var requiredApiVersion = 5;
|
|
59811
|
-
var assertOrmCoreVersion = async () => {
|
|
59812
|
-
try {
|
|
59813
|
-
const { compatibilityVersion } = await import("drizzle-orm/version");
|
|
59814
|
-
if (compatibilityVersion && compatibilityVersion === requiredApiVersion)
|
|
59815
|
-
return;
|
|
59816
|
-
if (!compatibilityVersion || compatibilityVersion < requiredApiVersion) {
|
|
59817
|
-
console.log(
|
|
59818
|
-
"This version of drizzle-kit requires newer version of drizzle-orm\nPlease update drizzle-orm package to the latest version \u{1F44D}"
|
|
59819
|
-
);
|
|
59820
|
-
} else {
|
|
59821
|
-
console.log(
|
|
59822
|
-
"This version of drizzle-kit is outdated\nPlease update drizzle-kit package to the latest version \u{1F44D}"
|
|
59823
|
-
);
|
|
59824
|
-
}
|
|
59825
|
-
} catch (e) {
|
|
59826
|
-
console.log(
|
|
59827
|
-
"Please install latest version of drizzle-orm"
|
|
59828
|
-
);
|
|
59829
|
-
}
|
|
59830
|
-
process.exit(1);
|
|
59831
|
-
};
|
|
59832
|
-
var ormCoreVersions = async () => {
|
|
59833
|
-
try {
|
|
59834
|
-
const { compatibilityVersion, npmVersion } = await import("drizzle-orm/version");
|
|
59835
|
-
return { compatibilityVersion, npmVersion };
|
|
59836
|
-
} catch (e) {
|
|
59837
|
-
return {};
|
|
59838
|
-
}
|
|
59839
|
-
};
|
|
59840
|
-
|
|
59841
|
-
// src/cli/index.ts
|
|
59900
|
+
init_utils3();
|
|
59842
59901
|
init_source();
|
|
59843
59902
|
|
|
59844
59903
|
// package.json
|
|
@@ -59898,7 +59957,7 @@ var package_default = {
|
|
|
59898
59957
|
]
|
|
59899
59958
|
},
|
|
59900
59959
|
dependencies: {
|
|
59901
|
-
"@drizzle-team/studio": "^0.0.
|
|
59960
|
+
"@drizzle-team/studio": "^0.0.17",
|
|
59902
59961
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
|
59903
59962
|
camelcase: "^7.0.1",
|
|
59904
59963
|
chalk: "^5.2.0",
|
|
@@ -59947,14 +60006,14 @@ var package_default = {
|
|
|
59947
60006
|
init_migrate();
|
|
59948
60007
|
init_utils2();
|
|
59949
60008
|
init_pgSchema();
|
|
59950
|
-
|
|
60009
|
+
init_utils5();
|
|
59951
60010
|
init_pgUp();
|
|
59952
60011
|
|
|
59953
60012
|
// src/cli/commands/sqliteUp.ts
|
|
59954
60013
|
init_source();
|
|
59955
60014
|
var import_fs9 = __toESM(require("fs"));
|
|
59956
60015
|
init_sqliteSchema();
|
|
59957
|
-
|
|
60016
|
+
init_utils5();
|
|
59958
60017
|
var upSqliteHandler = (out) => {
|
|
59959
60018
|
};
|
|
59960
60019
|
var upSqliteHandlerV4 = (out) => {
|
|
@@ -60545,7 +60604,7 @@ init_common();
|
|
|
60545
60604
|
init_mysql();
|
|
60546
60605
|
init_pgPushUtils();
|
|
60547
60606
|
init_outputs();
|
|
60548
|
-
var
|
|
60607
|
+
var import_server = require("@drizzle-team/studio/server");
|
|
60549
60608
|
init_sqlgenerator();
|
|
60550
60609
|
|
|
60551
60610
|
// node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/config.js
|
|
@@ -61251,14 +61310,20 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
|
|
|
61251
61310
|
var studioCommand = new import_commander.Command("studio").option("--port <port>", "Custom port for drizzle studio [default=4983]").option("--host <host>", "Custom host for drizzle studio [default=0.0.0.0]").option("--verbose", "Print all stataments that are executed by Studio").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
|
61252
61311
|
const { validateStudio: validateStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
|
61253
61312
|
const drizzleConfig = await validateStudio2(options);
|
|
61254
|
-
const { prepareModels: prepareModels2, drizzleDb: drizzleDb2 } = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
|
|
61313
|
+
const { prepareModels: prepareModels2, drizzleDb: drizzleDb2, drizzleForPostgres: drizzleForPostgres2 } = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
|
|
61255
61314
|
const models = await prepareModels2(drizzleConfig.schema);
|
|
61256
|
-
|
|
61257
|
-
|
|
61258
|
-
models
|
|
61259
|
-
options.verbose
|
|
61260
|
-
|
|
61261
|
-
|
|
61315
|
+
let setup;
|
|
61316
|
+
if (drizzleConfig.driver === "pg") {
|
|
61317
|
+
assertExists(models.pgSchema);
|
|
61318
|
+
setup = await drizzleForPostgres2(drizzleConfig, models.pgSchema, options.verbose);
|
|
61319
|
+
} else {
|
|
61320
|
+
setup = await drizzleDb2(
|
|
61321
|
+
drizzleConfig,
|
|
61322
|
+
models,
|
|
61323
|
+
options.verbose
|
|
61324
|
+
);
|
|
61325
|
+
}
|
|
61326
|
+
const server = await (0, import_server.prepareServer)(setup);
|
|
61262
61327
|
const port = options.port ?? 4983;
|
|
61263
61328
|
const host = options.host ?? "127.0.0.1";
|
|
61264
61329
|
console.log();
|