mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
@@ -6,6 +6,7 @@ import { PayloadService } from '../services/payload';
|
||||
import applyQuery from '../utils/apply-query';
|
||||
import Knex, { QueryBuilder } from 'knex';
|
||||
import { toArray } from '../utils/to-array';
|
||||
import { ServiceUnavailableException } from '../../dist/exceptions';
|
||||
|
||||
type RunASTOptions = {
|
||||
query?: AST['query'];
|
||||
@@ -22,6 +23,17 @@ export default async function runAST(
|
||||
|
||||
const knex = options?.knex || database;
|
||||
|
||||
for (const [collection, info] of Object.entries(schema)) {
|
||||
if (!info.primary) {
|
||||
throw new ServiceUnavailableException(
|
||||
`Collection "${collection}" doesn't have a primary key column`,
|
||||
{
|
||||
service: 'database',
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (ast.type === 'm2a') {
|
||||
const results: { [collection: string]: null | Item | Item[] } = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user