drizzle-kit 0.20.7-8d149c2 → 0.20.7-b11c289
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/bin.cjs +40 -16
- package/package.json +1 -1
package/bin.cjs
CHANGED
|
@@ -62402,13 +62402,16 @@ var import_path6 = require("path");
|
|
|
62402
62402
|
init_views();
|
|
62403
62403
|
init_migrate();
|
|
62404
62404
|
var import_fs11 = __toESM(require("fs"));
|
|
62405
|
-
var dropMigration = async (
|
|
62405
|
+
var dropMigration = async ({
|
|
62406
|
+
out,
|
|
62407
|
+
bundle
|
|
62408
|
+
}) => {
|
|
62406
62409
|
const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
|
|
62407
|
-
const journal = JSON.parse(
|
|
62408
|
-
(0, import_fs10.readFileSync)(metaFilePath, "utf-8")
|
|
62409
|
-
);
|
|
62410
|
+
const journal = JSON.parse((0, import_fs10.readFileSync)(metaFilePath, "utf-8"));
|
|
62410
62411
|
if (journal.entries.length === 0) {
|
|
62411
|
-
console.log(
|
|
62412
|
+
console.log(
|
|
62413
|
+
`[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`
|
|
62414
|
+
);
|
|
62412
62415
|
return;
|
|
62413
62416
|
}
|
|
62414
62417
|
const result = await (0, import_hanji8.render)(new DropMigrationView(journal.entries));
|
|
@@ -62420,12 +62423,25 @@ var dropMigration = async (out) => {
|
|
|
62420
62423
|
entries: journal.entries.filter(Boolean)
|
|
62421
62424
|
};
|
|
62422
62425
|
const sqlFilePath = (0, import_path6.join)(out, `${result.data.tag}.sql`);
|
|
62423
|
-
const snapshotFilePath = (0, import_path6.join)(
|
|
62426
|
+
const snapshotFilePath = (0, import_path6.join)(
|
|
62427
|
+
out,
|
|
62428
|
+
"meta",
|
|
62429
|
+
`${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`
|
|
62430
|
+
);
|
|
62424
62431
|
(0, import_fs10.rmSync)(sqlFilePath);
|
|
62425
62432
|
(0, import_fs10.rmSync)(snapshotFilePath);
|
|
62426
62433
|
(0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
|
|
62427
|
-
|
|
62428
|
-
|
|
62434
|
+
if (bundle) {
|
|
62435
|
+
import_fs11.default.writeFileSync(
|
|
62436
|
+
(0, import_path6.join)(out, `migrations.js`),
|
|
62437
|
+
embeddedMigrations(resultJournal)
|
|
62438
|
+
);
|
|
62439
|
+
}
|
|
62440
|
+
console.log(
|
|
62441
|
+
`[${source_default.green("\u2713")}] ${source_default.bold(
|
|
62442
|
+
result.data.tag
|
|
62443
|
+
)} migration successfully dropped`
|
|
62444
|
+
);
|
|
62429
62445
|
};
|
|
62430
62446
|
|
|
62431
62447
|
// src/cli/index.ts
|
|
@@ -63047,7 +63063,7 @@ var generateMysqlCommand = new import_commander.Command("generate:mysql").option
|
|
|
63047
63063
|
var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
|
|
63048
63064
|
"--config <config>",
|
|
63049
63065
|
"Path to a config.json file, drizzle.config.ts by default"
|
|
63050
|
-
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "MySQL connection string").option("--driver <driver>", "
|
|
63066
|
+
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "MySQL connection string").option("--driver <driver>", "Driver used for querying the database").option("--connectionString <connectionString>", "MySQL connection string").option("--host <host>", "MySQL host").option("--port <port>", "MySQL port").option("--user <user>", "MySQL user").option("--password <password>", "MySQL password").option("--database <database>", "MySQL database name").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
|
|
63051
63067
|
await printVersions();
|
|
63052
63068
|
await assertPackages("drizzle-orm");
|
|
63053
63069
|
await assertOrmCoreVersion();
|
|
@@ -63164,7 +63180,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
|
63164
63180
|
).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--schemaFilters", `Schema name filters`).option(
|
|
63165
63181
|
"--connectionString <connectionString>",
|
|
63166
63182
|
"PostgreSQL connection string"
|
|
63167
|
-
).option("--driver <driver>", "
|
|
63183
|
+
).option("--driver <driver>", "Driver used for querying the database").option(
|
|
63168
63184
|
"--connectionString <connectionString>",
|
|
63169
63185
|
"PostgreSQL connection string"
|
|
63170
63186
|
).option("--host <host>", "PostgreSQL host").option("--port <port>", "PostgreSQL port").option("--user <user>", "PostgreSQL user").option("--password <password>", "PostgreSQL password").option("--ssl <ssl>", "Postgres ssl").option("--database <database>", "PostgreSQL database name").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
|
|
@@ -63274,7 +63290,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
|
|
|
63274
63290
|
var dbPushSqliteCommand = new import_commander.Command("push:sqlite").option(
|
|
63275
63291
|
"--config <config>",
|
|
63276
63292
|
"Path to a config.ts file, drizzle.config.ts by default"
|
|
63277
|
-
).option("--schema <schema>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "SQLite connection string").option("--driver <driver>", "
|
|
63293
|
+
).option("--schema <schema>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "SQLite connection string").option("--driver <driver>", "Driver used for querying the database").option("--url <url>", "SQLite database path").option("--auth-token <authToken>", "SQLite database path").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
|
|
63278
63294
|
printVersions();
|
|
63279
63295
|
assertPackages("drizzle-orm");
|
|
63280
63296
|
assertOrmCoreVersion();
|
|
@@ -63389,7 +63405,8 @@ var generateSqliteCommand = new import_commander.Command("generate:sqlite").opti
|
|
|
63389
63405
|
});
|
|
63390
63406
|
var checkSchema = objectType({
|
|
63391
63407
|
out: stringType().optional(),
|
|
63392
|
-
config: stringType().optional()
|
|
63408
|
+
config: stringType().optional(),
|
|
63409
|
+
driver: stringType().optional()
|
|
63393
63410
|
}).strict();
|
|
63394
63411
|
var checkPgCommand = new import_commander.Command("check:pg").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
|
63395
63412
|
await printVersions();
|
|
@@ -63495,7 +63512,7 @@ var upSqliteCommand = new import_commander.Command("up:sqlite").option("--out <o
|
|
|
63495
63512
|
var introspectPgCommand = new import_commander.Command("introspect:pg").option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
|
|
63496
63513
|
"--introspect-casing <introspectCasing>",
|
|
63497
63514
|
"Column object keys naming strategy"
|
|
63498
|
-
).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "
|
|
63515
|
+
).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "Driver used for querying the database").option("--connectionString <connectionString>", "Postgres connection string").option("--host <host>", "Postgres host").option("--port <port>", "Postgres port").option("--user <user>", "Postgres user").option("--password <password>", "Postgres password").option("--database <database>", "Postgres database name").option("--ssl <ssl>", "Postgres ssl").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
|
63499
63516
|
await printVersions();
|
|
63500
63517
|
await assertPackages("drizzle-orm");
|
|
63501
63518
|
await assertOrmCoreVersion();
|
|
@@ -63608,7 +63625,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
|
63608
63625
|
).option(
|
|
63609
63626
|
"--introspect-casing <introspectCasing>",
|
|
63610
63627
|
"Column object keys naming strategy"
|
|
63611
|
-
).option("--tablesFilter", `Table name filters`).option("--schema <schema>", `Migrations folder`).option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--driver <driver>", "
|
|
63628
|
+
).option("--tablesFilter", `Table name filters`).option("--schema <schema>", `Migrations folder`).option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--driver <driver>", "Driver used for querying the database").option("--url <url>", "SQLite database url").option("--auth-token <authToken>", "SQLite database path").action(async (options) => {
|
|
63612
63629
|
printVersions();
|
|
63613
63630
|
assertPackages("drizzle-orm");
|
|
63614
63631
|
assertOrmCoreVersion();
|
|
@@ -63655,7 +63672,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
|
|
|
63655
63672
|
);
|
|
63656
63673
|
process.exit(0);
|
|
63657
63674
|
});
|
|
63658
|
-
var dropCommand = new import_commander.Command("drop").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
|
63675
|
+
var dropCommand = new import_commander.Command("drop").option("--out <out>", `Output folder`).option("--driver <driver>", `Driver used for querying the database`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
|
63659
63676
|
await printVersions();
|
|
63660
63677
|
await assertOrmCoreVersion();
|
|
63661
63678
|
const collisionRes = checkCollisions(
|
|
@@ -63668,8 +63685,15 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
|
|
|
63668
63685
|
}
|
|
63669
63686
|
const params = checkSchema.parse(options);
|
|
63670
63687
|
const out = await assertOutFolder(params);
|
|
63688
|
+
let bundle = false;
|
|
63689
|
+
if (typeof options.driver !== "undefined") {
|
|
63690
|
+
bundle = options.driver === "expo";
|
|
63691
|
+
} else {
|
|
63692
|
+
const drizzleConfig = await drizzleConfigFromFile(options.config);
|
|
63693
|
+
bundle = drizzleConfig.driver === "expo";
|
|
63694
|
+
}
|
|
63671
63695
|
assertV1OutFolder(out, "{dialect}");
|
|
63672
|
-
await dropMigration(out);
|
|
63696
|
+
await dropMigration({ out, bundle });
|
|
63673
63697
|
});
|
|
63674
63698
|
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) => {
|
|
63675
63699
|
await printVersions();
|