Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
fix(backend): fix apply migration file globs not working on windows (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Sep 30, 2024
1 parent 056b4d3 commit 18bfd83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/backend/toolchain/build/plan/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { copy, exists } from "@std/fs";

import * as esbuild from "esbuild";
import { BACKEND_ROOT } from "../../utils/paths.ts";
import { assert } from "@std/assert";

export async function planProjectBuild(
buildState: BuildState,
Expand Down Expand Up @@ -416,7 +417,12 @@ export async function planProjectBuild(

// Run apply in parallel since it's non-interactive
for (const module of applyMigrations) {
const migrations = await glob.glob(resolve(module.path, "db", "migrations", "*.sql"));
// List all migrations
const migrationsCwd = resolve(module.path, "db", "migrations")
const migrationsRelative = await glob.glob("*.sql", { cwd: migrationsCwd });
assert(migrationsRelative.length > 0, `must have more than 1 migration for module ${module.name}`);
const migrations = migrationsRelative.map(x => resolve(migrationsCwd, x));

buildStep(buildState, {
id: `module.${module.name}.migrate.apply`,
name: "Migrate Database",
Expand Down

0 comments on commit 18bfd83

Please sign in to comment.