Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ npm install -D @types/better-sqlite3
For Postgres:

```bash
npm install pg pg-connection-string
npm install pg
npm install -D @types/pg
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zenstack-v3",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"description": "ZenStack",
"packageManager": "pnpm@10.12.1",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "zenstack",
"displayName": "ZenStack CLI",
"description": "FullStack database toolkit with built-in access control and automatic API generation.",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"type": "module",
"author": {
"name": "ZenStack Team"
Expand All @@ -22,7 +22,7 @@
"zenstack": "bin/cli"
},
"scripts": {
"build": "tsup-node",
"build": "tsc --noEmit && tsup-node",
"watch": "tsup-node --watch",
"lint": "eslint src --ext ts",
"test": "vitest run",
Expand Down
29 changes: 29 additions & 0 deletions packages/cli/src/actions/migrate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'node:fs';
import path from 'node:path';
import { CliError } from '../cli-error';
import { execPackage } from '../utils/exec-utils';
import { generateTempPrismaSchema, getSchemaFile } from './action-utils';

Expand All @@ -21,6 +22,11 @@ type DeployOptions = CommonOptions;

type StatusOptions = CommonOptions;

type ResolveOptions = CommonOptions & {
applied?: string;
rolledBack?: string;
};

/**
* CLI action for migration-related commands
*/
Expand All @@ -46,6 +52,10 @@ export async function run(command: string, options: CommonOptions) {
case 'status':
await runStatus(prismaSchemaFile, options as StatusOptions);
break;

case 'resolve':
await runResolve(prismaSchemaFile, options as ResolveOptions);
break;
}
} finally {
if (fs.existsSync(prismaSchemaFile)) {
Expand Down Expand Up @@ -100,6 +110,25 @@ async function runStatus(prismaSchemaFile: string, _options: StatusOptions) {
}
}

async function runResolve(prismaSchemaFile: string, options: ResolveOptions) {
if (!options.applied && !options.rolledBack) {
throw new CliError('Either --applied or --rolled-back option must be provided');
}

try {
const cmd = [
'prisma migrate resolve',
` --schema "${prismaSchemaFile}"`,
options.applied ? ` --applied ${options.applied}` : '',
options.rolledBack ? ` --rolled-back ${options.rolledBack}` : '',
].join('');

await execPackage(cmd);
} catch (err) {
handleSubProcessError(err);
}
}

function handleSubProcessError(err: unknown) {
if (err instanceof Error && 'status' in err && typeof err.status === 'number') {
process.exit(err.status);
Expand Down
11 changes: 10 additions & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,18 @@ export function createProgram() {
.command('status')
.addOption(schemaOption)
.addOption(migrationsOption)
.description('check the status of your database migrations.')
.description('Check the status of your database migrations.')
.action((options) => migrateAction('status', options));

migrateCommand
.command('resolve')
.addOption(schemaOption)
.addOption(migrationsOption)
.addOption(new Option('--applied <migration>', 'record a specific migration as applied'))
.addOption(new Option('--rolled-back <migration>', 'record a specific migration as rolled back'))
.description('Resolve issues with database migrations in deployment databases')
.action((options) => migrateAction('resolve', options));

Comment on lines +101 to +109
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Resolve subcommand wiring LGTM; confirm whether both flags can be used together

The action accepts either or both of --applied and --rolled-back. Prisma typically allows multiple resolve operations in one call, but please confirm this is intended and supported to avoid surprising UX; otherwise, consider marking the options as conflicting in Commander.


🌐 Web query:

Does Prisma CLI support using both --applied and --rolled-back simultaneously with `prisma migrate resolve`?

💡 Result:

Short answer: No — you cannot use both at the same time. prisma migrate resolve requires you to specify either --applied or --rolled-back (they are mutually exclusive). (prisma.io)

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Locating files mentioning 'migrateCommand'..."
rg -n --hidden --no-ignore -S "migrateCommand" || true

echo
echo "Showing surrounding context for packages/cli/src/index.ts (if present):"
if [ -f packages/cli/src/index.ts ]; then
  echo "----- packages/cli/src/index.ts -----"
  nl -ba packages/cli/src/index.ts | sed -n '1,240p'
else
  echo "packages/cli/src/index.ts not found"
fi

Length of output: 987


Make --applied and --rolled-back mutually exclusive (fix required)

Prisma's CLI does not allow using both flags at once for migrate resolve — the command requires either --applied or --rolled-back, not both (prisma docs). Prevent both being selected in our CLI to avoid runtime errors.

  • Location: packages/cli/src/index.ts — migrate resolve command (around line ~101).
  • Action: enforce mutual exclusivity — either declare the options as conflicting via Commander or add a guard in the action handler that errors if both are passed.

Suggested minimal change:

migrateCommand
  .command('resolve')
  .addOption(schemaOption)
  .addOption(migrationsOption)
  .addOption(new Option('--applied <migration>', 'record a specific migration as applied'))
  .addOption(new Option('--rolled-back <migration>', 'record a specific migration as rolled back'))
  .description('Resolve issues with database migrations in deployment databases')
  .action((options) => {
    if (options.applied && options.rolledBack) {
      throw new Error('Cannot use --applied and --rolled-back together. Choose one.');
    }
    migrateAction('resolve', options);
  });
🤖 Prompt for AI Agents
In packages/cli/src/index.ts around lines 101 to 109, the migrate resolve
subcommand currently allows both --applied and --rolled-back to be passed which
Prisma forbids; enforce mutual exclusivity by either marking the two options as
conflicting on the Commander Option objects (use Option.prototype.conflicts with
the other option name) or add a small guard in the .action handler that checks
if options.applied and options.rolledBack are both set and throws a clear error
(e.g., "Cannot use --applied and --rolled-back together. Choose one.") before
calling migrateAction.

const dbCommand = program.command('db').description('Manage your database schema during development.');

dbCommand
Expand Down
31 changes: 31 additions & 0 deletions packages/cli/test/migrate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,35 @@ describe('CLI migrate commands test', () => {
runCli('migrate dev --name init', workDir);
runCli('migrate status', workDir);
});

it('supports migrate resolve', () => {
const workDir = createProject(model);
runCli('migrate dev --name init', workDir);

// find the migration record "timestamp_init"
const migrationRecords = fs.readdirSync(path.join(workDir, 'zenstack/migrations'));
const migration = migrationRecords.find((f) => f.endsWith('_init'));

// force a migration failure
fs.writeFileSync(path.join(workDir, 'zenstack/migrations', migration!, 'migration.sql'), 'invalid content');

// redeploy the migration, which will fail
fs.rmSync(path.join(workDir, 'zenstack/dev.db'), { force: true });
try {
runCli('migrate deploy', workDir);
} catch {
// noop
}

// --rolled-back
runCli(`migrate resolve --rolled-back ${migration}`, workDir);

// --applied
runCli(`migrate resolve --applied ${migration}`, workDir);
});

it('should throw error when neither applied nor rolled-back is provided', () => {
const workDir = createProject(model);
expect(() => runCli('migrate resolve', workDir)).toThrow();
});
});
2 changes: 1 addition & 1 deletion packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@zenstackhq/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist"
"baseUrl": "."
},
"include": ["src/**/*.ts"]
}
4 changes: 2 additions & 2 deletions packages/common-helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@zenstackhq/common-helpers",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"description": "ZenStack Common Helpers",
"type": "module",
"scripts": {
"build": "tsup-node",
"build": "tsc --noEmit && tsup-node",
"watch": "tsup-node --watch",
"lint": "eslint src --ext ts",
"pack": "pnpm pack"
Expand Down
2 changes: 1 addition & 1 deletion packages/common-helpers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@zenstackhq/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist"
"baseUrl": "."
},
"include": ["src/**/*.ts"]
}
4 changes: 2 additions & 2 deletions packages/create-zenstack/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "create-zenstack",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"description": "Create a new ZenStack project",
"type": "module",
"scripts": {
"build": "tsup-node",
"build": "tsc --noEmit && tsup-node",
"lint": "eslint src --ext ts",
"pack": "pnpm pack"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-zenstack/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@zenstackhq/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist"
"baseUrl": "."
},
"include": ["src/**/*.ts"]
}
4 changes: 2 additions & 2 deletions packages/dialects/sql.js/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@zenstackhq/kysely-sql-js",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"description": "Kysely dialect for sql.js",
"type": "module",
"scripts": {
"build": "tsup-node",
"build": "tsc --noEmit && tsup-node",
"watch": "tsup-node --watch",
"lint": "eslint src --ext ts",
"pack": "pnpm pack"
Expand Down
4 changes: 2 additions & 2 deletions packages/dialects/sql.js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@zenstackhq/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist"
"baseUrl": "."
},
"include": ["src/**/*", "test/**/*"]
"include": ["src/**/*"]
Comment on lines +4 to +6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

baseUrl addition is fine; consider explicitly excluding build and tests

The narrowed include to src only is good for package builds. As a small hardening, you can explicitly exclude typical folders to avoid accidental type-checking if files land there in the future.

Apply this diff:

 {
     "extends": "@zenstackhq/typescript-config/base.json",
     "compilerOptions": {
         "baseUrl": "."
     },
-    "include": ["src/**/*"]
+    "include": ["src/**/*"],
+    "exclude": ["dist", "build", "coverage", "node_modules", "test", "tests"]
 }

Also ensure your test runner uses its own tsconfig if test files relied on the package tsconfig previously.

Run to confirm tests have an explicit tsconfig or separate config:


🏁 Script executed:

#!/bin/bash
# Look for a test-specific tsconfig under this package or repo-level config used by tests.
fd -a -i --type f '^tsconfig\.(test|spec)\.json$' | sed 's/^/found: /'
rg -n -C2 -g '!**/node_modules/**' -P '(vitest|jest).*config' 

Length of output: 6318


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "---- packages/dialects/sql.js/tsconfig.json ----"
sed -n '1,200p' packages/dialects/sql.js/tsconfig.json || echo "missing"

echo
echo "---- packages/dialects/sql.js/vitest.config.ts ----"
sed -n '1,200p' packages/dialects/sql.js/vitest.config.ts || echo "missing"

echo
echo "---- packages/vitest-config/base.config.js ----"
sed -n '1,200p' packages/vitest-config/base.config.js || echo "missing"

echo
echo "---- search for tsconfig.* in that package ----"
rg -n --hidden -g '!**/node_modules/**' 'tsconfig' packages/dialects/sql.js -S || true

echo
echo "---- all tsconfig.test/spec files in repo ----"
fd -a -i --type f '^tsconfig\.(test|spec)\.json$' | sed 's/^/found: /' || true

Length of output: 1534


baseUrl addition is fine; add explicit excludes and confirm test tsconfig

Short check: packages/dialects/sql.js/tsconfig.json currently limits "include" to "src//*", and the package's Vitest config merges the workspace base (which includes '/*.test.ts'). There is no package-level tsconfig.test.json (only found packages/runtime/tsconfig.test.json), so tests in this package will still pick up the package tsconfig unless you add a test-specific tsconfig.

Files to update / inspect:

  • packages/dialects/sql.js/tsconfig.json — add explicit excludes.
  • packages/dialects/sql.js/vitest.config.ts — currently merges base; add a package tsconfig.test.json or configure Vitest to use a separate tsconfig if you want tests to use a different TS setup.

Apply this diff:

 {
     "extends": "@zenstackhq/typescript-config/base.json",
     "compilerOptions": {
         "baseUrl": "."
     },
-    "include": ["src/**/*"]
+    "include": ["src/**/*"],
+    "exclude": ["dist", "build", "coverage", "node_modules", "test", "tests"]
 }

Note: excluding "test" / "tests" won't remove test files that live under src (src/**/*.test.ts). If you need that, create a package-level tsconfig.test.json or point Vitest to a different tsconfig.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"baseUrl": "."
},
"include": ["src/**/*", "test/**/*"]
"include": ["src/**/*"]
{
"extends": "@zenstackhq/typescript-config/base.json",
"compilerOptions": {
"baseUrl": "."
},
"include": ["src/**/*"],
"exclude": ["dist", "build", "coverage", "node_modules", "test", "tests"]
}
🤖 Prompt for AI Agents
In packages/dialects/sql.js/tsconfig.json around lines 4 to 6 the config only
sets "baseUrl" and "include": ["src/**/*"] which can let workspace-wide test
globs leak in; add an explicit "exclude" array (e.g. exclude node_modules, dist,
and any top-level test directories like "test" or "tests") to the package
tsconfig, and either add a package-level tsconfig.test.json (mirroring the
workspace test settings) or update packages/dialects/sql.js/vitest.config.ts to
point Vitest to a separate tsconfig so tests under src/**/*.test.ts are handled
by the intended test TS config rather than the package tsconfig.

}
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zenstackhq/eslint-config",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"type": "module",
"private": true,
"license": "MIT"
Expand Down
2 changes: 1 addition & 1 deletion packages/ide/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zenstack",
"publisher": "zenstack",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"displayName": "ZenStack Language Tools",
"description": "VSCode extension for ZenStack ZModel language",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/ide/vscode/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@zenstackhq/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist"
"baseUrl": "."
},
"include": ["src/**/*.ts"]
}
4 changes: 2 additions & 2 deletions packages/language/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zenstackhq/language",
"description": "ZenStack ZModel language specification",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"license": "MIT",
"author": "ZenStack Team",
"files": [
Expand All @@ -10,7 +10,7 @@
],
"type": "module",
"scripts": {
"build": "pnpm langium:generate && tsup-node",
"build": "pnpm langium:generate && tsc --noEmit && tsup-node",
"lint": "eslint src --ext ts",
"langium:generate": "langium generate",
"langium:generate:production": "langium generate --mode=production",
Expand Down
4 changes: 2 additions & 2 deletions packages/language/src/validators/typedef-validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ValidationAcceptor } from 'langium';
import type { TypeDef, TypeDefField } from '../generated/ast';
import type { DataField, TypeDef } from '../generated/ast';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Import switch to DataField is correct and consistent with generated AST

Matches the generated AST where DataField can be contained by TypeDef. Good alignment with the model changes.

Run this to confirm there are no straggling TypeDefField references and that TypeDef.fields is typed to DataField:


🏁 Script executed:

#!/bin/bash
set -e

# 1) Ensure no residual TypeDefField usages remain
rg -nP --type=ts -C2 '\bTypeDefField\b' || echo "OK: No TypeDefField references found."

# 2) Inspect TypeDef.fields type in the generated AST
# Expectation: fields: Array<DataField>
rg -nPU --type=ts -C3 '(?s)^\s*export\s+interface\s+TypeDef\b.*?^\s*fields\s*:\s*Array<[^>]+>' packages/language/src/generated/ast.ts || \
  rg -nPU --type=ts -C3 '(?s)^\s*export\s+interface\s+TypeDef\b.*?^\s*fields\s*:\s*Array<[^>]+>' 

Length of output: 1240


Import to DataField is correct — one leftover 'TypeDefField' reference must be fixed

TypeDef.fields is already typed to Array in the generated AST, but there is at least one remaining reference to "TypeDefField" that should be updated.

Files to fix:

  • packages/language/src/generated/ast.ts — TypeDef.fields: Array (lines ~725–733) — OK.
  • packages/language/src/validators/attribute-application-validator.ts:422 — case 'TypeDefField' — update this to the new name (e.g., 'DataField') or adjust the switch logic accordingly.
🤖 Prompt for AI Agents
In packages/language/src/validators/attribute-application-validator.ts around
line 422 there's a switch/case still matching the legacy string 'TypeDefField'
even though the AST now uses DataField; change the case label to 'DataField' (or
add a fall-through to handle both 'TypeDefField' and 'DataField' if backward
compatibility is required), and ensure any related type references or imports
align with the generated AST (the typedef-validator.ts import at line 2 already
imports DataField and TypeDef correctly).

import { validateAttributeApplication } from './attribute-application-validator';
import { validateDuplicatedDeclarations, type AstValidator } from './common';

Expand All @@ -21,7 +21,7 @@ export default class TypeDefValidator implements AstValidator<TypeDef> {
typeDef.fields.forEach((field) => this.validateField(field, accept));
}

private validateField(field: TypeDefField, accept: ValidationAcceptor): void {
private validateField(field: DataField, accept: ValidationAcceptor): void {
field.attributes.forEach((attr) => validateAttributeApplication(attr, accept));
}
}
2 changes: 1 addition & 1 deletion packages/language/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@zenstackhq/typescript-config/base.json",
"compilerOptions": {
"outDir": "dist"
"baseUrl": "."
},
"include": ["src/**/*.ts"]
}
4 changes: 2 additions & 2 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@zenstackhq/runtime",
"version": "3.0.0-alpha.24",
"version": "3.0.0-alpha.25",
"description": "ZenStack Runtime",
"type": "module",
"scripts": {
"build": "tsup-node && pnpm test:generate",
"build": "tsc --project tsconfig.build.json --noEmit && tsup-node && pnpm test:generate",
"watch": "tsup-node --watch",
"lint": "eslint src --ext ts",
"test": "vitest run && pnpm test:typecheck",
Expand Down
10 changes: 8 additions & 2 deletions packages/runtime/src/client/crud/dialects/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,14 @@ export abstract class BaseCrudDialect<Schema extends SchemaDef> {
return eb.not(this.and(eb, ...args));
}

fieldRef(model: string, field: string, eb: ExpressionBuilder<any, any>, modelAlias?: string) {
return buildFieldRef(this.schema, model, field, this.options, eb, modelAlias);
fieldRef(
model: string,
field: string,
eb: ExpressionBuilder<any, any>,
modelAlias?: string,
inlineComputedField = true,
) {
return buildFieldRef(this.schema, model, field, this.options, eb, modelAlias, inlineComputedField);
}

// #endregion
Expand Down
6 changes: 3 additions & 3 deletions packages/runtime/src/client/crud/dialects/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ export class PostgresCrudDialect<Schema extends SchemaDef> extends BaseCrudDiale
...Object.entries(relationModelDef.fields)
.filter(([, value]) => !value.relation)
.filter(([name]) => !(typeof payload === 'object' && (payload.omit as any)?.[name] === true))
.map(([field]) => [sql.lit(field), this.fieldRef(relationModel, field, eb)])
.map(([field]) => [sql.lit(field), this.fieldRef(relationModel, field, eb, undefined, false)])
.flatMap((v) => v),
);
} else if (payload.select) {
// select specific fields
objArgs.push(
...Object.entries(payload.select)
...Object.entries<any>(payload.select)
.filter(([, value]) => value)
.map(([field, value]) => {
if (field === '_count') {
Expand All @@ -249,7 +249,7 @@ export class PostgresCrudDialect<Schema extends SchemaDef> extends BaseCrudDiale
? // reference the synthesized JSON field
eb.ref(`${parentAlias}$${relationField}$${field}.$j`)
: // reference a plain field
this.fieldRef(relationModel, field, eb);
this.fieldRef(relationModel, field, eb, undefined, false);
return [sql.lit(field), fieldValue];
}
})
Expand Down
7 changes: 5 additions & 2 deletions packages/runtime/src/client/crud/dialects/sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class SqliteCrudDialect<Schema extends SchemaDef> extends BaseCrudDialect
...Object.entries(relationModelDef.fields)
.filter(([, value]) => !value.relation)
.filter(([name]) => !(typeof payload === 'object' && (payload.omit as any)?.[name] === true))
.map(([field]) => [sql.lit(field), this.fieldRef(relationModel, field, eb)])
.map(([field]) => [sql.lit(field), this.fieldRef(relationModel, field, eb, undefined, false)])
.flatMap((v) => v),
);
} else if (payload.select) {
Expand Down Expand Up @@ -199,7 +199,10 @@ export class SqliteCrudDialect<Schema extends SchemaDef> extends BaseCrudDialect
);
return [sql.lit(field), subJson];
} else {
return [sql.lit(field), this.fieldRef(relationModel, field, eb) as ArgsType];
return [
sql.lit(field),
this.fieldRef(relationModel, field, eb, undefined, false) as ArgsType,
];
}
}
})
Expand Down
7 changes: 4 additions & 3 deletions packages/runtime/src/client/crud/operations/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { ExpressionUtils, type GetModels, type ModelDef, type SchemaDef } from '
import { clone } from '../../../utils/clone';
import { enumerate } from '../../../utils/enumerate';
import { extractFields, fieldsToSelectObject } from '../../../utils/object-utils';
import { CONTEXT_COMMENT_PREFIX, NUMERIC_FIELD_TYPES } from '../../constants';
import { NUMERIC_FIELD_TYPES } from '../../constants';
import type { CRUD } from '../../contract';
import type { FindArgs, SelectIncludeOmit, SortOrder, WhereInput } from '../../crud-types';
import { InternalError, NotFoundError, QueryError } from '../../errors';
Expand Down Expand Up @@ -1303,8 +1303,9 @@ export abstract class BaseOperationHandler<Schema extends SchemaDef> {
return NUMERIC_FIELD_TYPES.includes(fieldDef.type) && !fieldDef.array;
}

private makeContextComment(context: { model: GetModels<Schema>; operation: CRUD }) {
return sql.raw(`${CONTEXT_COMMENT_PREFIX}${JSON.stringify(context)}`);
private makeContextComment(_context: { model: GetModels<Schema>; operation: CRUD }) {
return sql``;
// return sql.raw(`${CONTEXT_COMMENT_PREFIX}${JSON.stringify(context)}`);
}

protected async updateMany<
Expand Down
Loading
Loading