@devdogsuga/devtools 0.1.5 → 0.1.6

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/dist/cli.js CHANGED
@@ -26,7 +26,6 @@ import { connectRemoteProject, runStackCommand, } from "./stack.js";
26
26
  import { runConfigPush } from "./db/config-push.js";
27
27
  import { describeDbTarget, isLocalConnection, resolveDbConnection, } from "./db/connection.js";
28
28
  import { runDbExec } from "./db/exec.js";
29
- import { runGenerateMigration } from "./db/generate-migration.js";
30
29
  import { runGenerateTypes } from "./db/generate-types.js";
31
30
  import { runIntrospect } from "./db/introspect.js";
32
31
  import { runNewMigration } from "./db/new-migration.js";
@@ -609,11 +608,6 @@ async function runDbCommand(rest) {
609
608
  process.exitCode = code === 0 ? 0 : 1;
610
609
  return;
611
610
  }
612
- if (msub === "generate") {
613
- const code = await runGenerateMigration(flagValue(mrest, "--app"));
614
- process.exitCode = code === 0 ? 0 : 1;
615
- return;
616
- }
617
611
  log.error(msub
618
612
  ? `devtools db migration: unknown subcommand "${msub}". Try ${subcommandList(["db", "migration"])}.`
619
613
  : `devtools db migration: which of ${subcommandList(["db", "migration"])}?`);
package/dist/commands.js CHANGED
@@ -839,7 +839,7 @@ const DECLARED_GROUPS = [
839
839
  // ── repo — files in the repo, no live connection ───────────────
840
840
  {
841
841
  name: "migration",
842
- summary: "Migration files, empty or drafted from schema drift.",
842
+ summary: "Empty timestamped migration files, hand-authored.",
843
843
  scope: "repo",
844
844
  subcommands: [
845
845
  {
@@ -854,17 +854,6 @@ const DECLARED_GROUPS = [
854
854
  },
855
855
  ],
856
856
  },
857
- {
858
- name: "generate",
859
- summary: "Generate a migration from an app's Drizzle schema drift.",
860
- options: [
861
- {
862
- flag: "--app",
863
- value: "<slug>",
864
- summary: "Whose schema. Asked for when absent.",
865
- },
866
- ],
867
- },
868
857
  ],
869
858
  },
870
859
  // ── endpoint — the session's database ──────────────────────────
@@ -28,6 +28,15 @@ const APP_CONFIGS = {
28
28
  schemaSuffix: "InPlatform",
29
29
  crossSchemaImport: 'import { usersInAuth as users, oauthClientsInAuth as oauthClients } from "~/supabase/drizzle/schema"',
30
30
  },
31
+ "schedule-builder": {
32
+ configs: ["drizzle-introspection.config.ts", "drizzle.config.ts"],
33
+ schemaFile: "src/server/db/schema/generated/schema.ts",
34
+ schemaSuffix: "InScheduleBuilder",
35
+ // schedule_builder's own tables carry no foreign keys into another
36
+ // schema (its `userId` columns are bare uuids, not FK-constrained to
37
+ // auth.users), so there is nothing to re-inject here.
38
+ crossSchemaImport: null,
39
+ },
31
40
  };
32
41
  // ── drizzle-kit pull ──────────────────────────────────────────────────────────
33
42
  function runDrizzlePull(appDir, configFile, env) {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The environment `db introspect` and `db migration generate` hand to the
3
- * `drizzle-kit` child process they spawn.
2
+ * The environment `db introspect` hands to the `drizzle-kit` child process
3
+ * it spawns.
4
4
  *
5
5
  * ## How this relates to `db/connection.ts`
6
6
  *
@@ -51,7 +51,7 @@ export interface ResolveLocalToolingEnvOptions {
51
51
  }
52
52
  /**
53
53
  * Returns the environment a local-tooling child process (`drizzle-kit`,
54
- * spawned by `db introspect` / `db migration generate`) should inherit.
54
+ * spawned by `db introspect`) should inherit.
55
55
  *
56
56
  * Normal path (the process went through `launch.ts`, as `pnpm devtools`
57
57
  * always does): returns `process.env` unchanged — it already carries
@@ -1,7 +1,7 @@
1
1
  import { loadEnvLoad } from "../repo/peers.js";
2
2
  /**
3
3
  * Returns the environment a local-tooling child process (`drizzle-kit`,
4
- * spawned by `db introspect` / `db migration generate`) should inherit.
4
+ * spawned by `db introspect`) should inherit.
5
5
  *
6
6
  * Normal path (the process went through `launch.ts`, as `pnpm devtools`
7
7
  * always does): returns `process.env` unchanged — it already carries
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devdogsuga/devtools",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Contributor CLI for a DevDogsUGA checkout: database, env, images, emails, cron, deploy. Ships built JS; run via `pnpm dlx @devdogsuga/devtools` (or the `devtools`/`devtools-ci` bins once installed) from inside a DevDogsUGA clone.",
@@ -63,9 +63,9 @@
63
63
  "react": "^19.2.8",
64
64
  "vitest": "^4.1.11",
65
65
  "@devdogsuga/brand": "0.1.1",
66
- "@devdogsuga/config": "0.1.1",
67
66
  "@devdogsuga/env": "0.1.1",
68
- "@devdogsuga/db": "0.1.1"
67
+ "@devdogsuga/db": "0.1.1",
68
+ "@devdogsuga/config": "0.1.1"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "tsc && node scripts/write-build-info.mjs",
@@ -1 +0,0 @@
1
- export declare function runGenerateMigration(appSlug?: string): Promise<number>;
@@ -1,67 +0,0 @@
1
- /**
2
- * `db migration generate [--app <slug>]` — draft a migration from an app's
3
- * Drizzle schema drift.
4
- *
5
- * Absorbs schedule-builder's `db:generate` package script (`with-env
6
- * drizzle-kit generate --config drizzle-migrations.config.ts`), the same way
7
- * `db introspect` absorbed platform's `db:pull`. It touches no database: it
8
- * diffs the schema files against drizzle-kit's own snapshot and writes SQL
9
- * under the app's `drizzle-generated/`, a draft to be carried by hand into a
10
- * real migration under `supabase/migrations/` — never something that runs on
11
- * its own. `DB_URL` is still required because drizzle-kit's Postgres
12
- * introspection needs a live connection to compare against, matching what
13
- * `with-env` supplied before — sourced via `resolveLocalToolingEnv`, the
14
- * tier this process already entered rather than a raw `.env` parse. See
15
- * `db/local-env.ts`'s header.
16
- */
17
- import { spawn } from "node:child_process";
18
- import { join } from "node:path";
19
- import { select } from "@clack/prompts";
20
- import { findRepoRoot } from "../repo/root.js";
21
- import { unwrap } from "../ui.js";
22
- import { resolveLocalToolingEnv } from "./local-env.js";
23
- // ── Per-app config ────────────────────────────────────────────────────────────
24
- /** Apps whose Drizzle schema drafts migrations via `drizzle-kit generate`. */
25
- const APP_CONFIGS = {
26
- "schedule-builder": "drizzle-migrations.config.ts",
27
- };
28
- async function pickApp() {
29
- const names = Object.keys(APP_CONFIGS);
30
- if (names.length === 1)
31
- return names[0];
32
- return unwrap(await select({
33
- message: "Whose schema drift should I draft a migration from?",
34
- options: names.map((value) => ({ value, label: value })),
35
- }));
36
- }
37
- function runDrizzleGenerate(appDir, configFile, env) {
38
- return new Promise((resolve) => {
39
- const child = spawn("pnpm", ["exec", "drizzle-kit", "generate", "--config", configFile], { stdio: "inherit", cwd: appDir, env });
40
- child.on("exit", (code) => resolve(code ?? 1));
41
- });
42
- }
43
- // ── Entry ─────────────────────────────────────────────────────────────────────
44
- export async function runGenerateMigration(appSlug) {
45
- const app = appSlug ?? (await pickApp());
46
- const configFile = APP_CONFIGS[app];
47
- if (!configFile) {
48
- const valid = Object.keys(APP_CONFIGS).join(", ");
49
- process.stderr.write(`devtools db migration generate: unknown app "${app}". Expected: ${valid}.\n`);
50
- return 1;
51
- }
52
- const appDir = join(findRepoRoot(), "apps", app);
53
- // Matching `db introspect`'s approach: `pnpm devtools` enters a tier into
54
- // `process.env` before dispatch (`launch.ts`), but drizzle-kit here runs as
55
- // its own child process in the app's directory, so that entered
56
- // environment needs to be injected explicitly rather than inherited
57
- // implicitly.
58
- const env = await resolveLocalToolingEnv();
59
- if (!env["DB_URL"]) {
60
- process.stderr.write("devtools db migration generate: DB_URL is not set. Run " +
61
- "`pnpm devtools db start` first (for local — its connection string " +
62
- "lives in .env.generated once the stack is up), or set DB_URL in " +
63
- "the deploy tier's env file this process entered.\n");
64
- return 1;
65
- }
66
- return runDrizzleGenerate(appDir, configFile, env);
67
- }