Lines 1-50javascript
1import { execa } from 'execa';
2import { promises } from 'fs';
3import { join } from 'path';
5// src/commands/migrate-status.ts
6var SCHEMA_FILE = "prisma/schema.prisma";
7var MIGRATIONS_DIR = "prisma/migrations";
8async function pathExists(path) {
10 await promises.access(path);
16async function detectPrismaLayout(projectPath) {
18 schemaExists: await pathExists(join(projectPath, SCHEMA_FILE)),
19 migrationsExists: await pathExists(join(projectPath, MIGRATIONS_DIR))
23// src/commands/migrate-status.ts
24async function migrateStatus(ctx) {
25 const layout = await detectPrismaLayout(ctx.projectPath);
26 if (!layout.schemaExists) {
27 ctx.logger.warn(`No ${SCHEMA_FILE} in ${ctx.projectPath} \u2014 nothing to check.`);
30 ctx.logger.info(`Running \`npx prisma migrate status\` in ${ctx.projectPath}...`);
31 const res = await execa("npx", ["prisma", "migrate", "status"], {
32 cwd: ctx.projectPath,
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
dist/plugin.jsView on unpkg · L30 36 if (res.exitCode === 0) {
37 ctx.logger.info("Migrations are up to date.");
39 ctx.logger.warn(`prisma migrate status exited ${res.exitCode}. See output above.`);
42async function listMigrations(projectPath) {
43 const dir = join(projectPath, MIGRATIONS_DIR);
44 const entries = await promises.readdir(dir, { withFileTypes: true });
45 const migrations = [];
46 for (const e of entries) {
47 if (!e.isDirectory()) continue;
48 const appliedMarker = join(dir, e.name, "migration.sql");