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
4 changes: 2 additions & 2 deletions src/packages/mikroorm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"reflect-metadata": "0.2.2"
},
"peerDependencies": {
"graphql": "16",
"@mikro-orm/core": "6",
"@mikro-orm/knex": "6"
"@mikro-orm/knex": "6",
"graphql": "16"
},
"devDependencies": {
"@mikro-orm/core": "6.4.16",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type {
Platform,
} from '@mikro-orm/core';
import { ReferenceKind, Utils } from '@mikro-orm/core';

import pluralize from 'pluralize';
import { identifierForEnumValue, pascalToCamelCaseString, pascalToKebabCaseString } from '../utils';
import { BaseFile } from './base-file';
Expand Down Expand Up @@ -103,7 +102,18 @@ export class SchemaEntityFile extends BaseFile {
}

this.coreImports.add('Entity');
file += `@Entity<${this.meta.className}>(${this.quote(this.meta.className)}, {\n\tprovider: new MikroBackendProvider(Orm${this.meta.className}, connection, { backendDisplayName: '${friendlyNameForDatabaseType(this.databaseType)}' }),\n})\n`;

file += `@Entity<${this.meta.className}>(${this.quote(this.meta.className)}, {\n\tprovider: new MikroBackendProvider(Orm${this.meta.className}, connection, { backendDisplayName: '${friendlyNameForDatabaseType(this.databaseType)}'})`;

if (props.length === 1 && props[0].primary) {
// Special case. If there's a single primary key field in this entity, right now that requires that it's a client side generated primary key.
// There's no reason this has to be the case, but it's a current limitation, so we should generate a working project for them.
// We should be able to remove this in the future and allow users to use it both ways.
file += `,\n\tapiOptions: { clientGeneratedPrimaryKeys: true },\n})\n`;
} else {
file += `\n})\n`;
}

file += `export class ${this.meta.className} {\n`;
file += `${classBody}}\n`;
const imports = [
Expand Down
Loading