MCPcopy
hub / github.com/directus/directus / id

Method id

packages/schema-builder/src/field.ts:60–70  ·  view source on GitHub ↗

Shorthand for creating an integer field and marking it as the primary field

()

Source from the content-addressed store, hash-verified

58
59 /** Shorthand for creating an integer field and marking it as the primary field */
60 id(): this {
61 this._data = {
62 field: this._data.field,
63 ...ID_FIELD,
64 _kind: 'finished',
65 };
66
67 if (this._collection) this.primary();
68
69 return this;
70 }
71
72 options(options: FieldOveriewBuilderOptions): this {
73 assert(this._data._kind !== 'initial', 'Cannot configure field before specifing a type');

Calls 1

primaryMethod · 0.95

Tested by

no test coverage detected