feat: all fields optional
This commit is contained in:
@@ -26,7 +26,7 @@ const init: Migration = {
|
||||
table.text('text').nullable();
|
||||
table.string('source').nullable();
|
||||
table.string('sourceId').nullable();
|
||||
table.string('type').notNullable();
|
||||
table.string('type').nullable();
|
||||
table.integer('typeVersion').nullable();
|
||||
table.jsonb('metadata').nullable();
|
||||
|
||||
@@ -78,9 +78,9 @@ type DocumentRow = {
|
||||
text: string | null;
|
||||
source: string | null;
|
||||
sourceId: string | null;
|
||||
type: string;
|
||||
type: string | null;
|
||||
typeVersion: number | null;
|
||||
metadata: unknown;
|
||||
metadata: unknown | null;
|
||||
};
|
||||
|
||||
type DocumentChunkRow = {
|
||||
|
||||
@@ -14,9 +14,9 @@ const documentSchema = z
|
||||
text: z.string().nullable(),
|
||||
source: z.string().nullable(),
|
||||
sourceId: z.string().nullable(),
|
||||
type: z.string(),
|
||||
type: z.string().nullable(),
|
||||
typeVersion: z.int().nullable(),
|
||||
metadata: z.unknown(),
|
||||
metadata: z.unknown().nullable(),
|
||||
})
|
||||
.meta({ id: 'Document' });
|
||||
|
||||
@@ -31,7 +31,7 @@ const documentUpsertSchema = z
|
||||
text: z.string().nullish(),
|
||||
source: z.string().nullish(),
|
||||
sourceId: z.string().nullish(),
|
||||
type: z.string().optional(),
|
||||
type: z.string().nullish(),
|
||||
typeVersion: z.int().nullish(),
|
||||
metadata: z.unknown().nullish(),
|
||||
})
|
||||
|
||||
@@ -120,8 +120,6 @@ class DocumentsService extends EventEmitter<DocumentsServiceEvents> {
|
||||
} as const;
|
||||
} else {
|
||||
await trx<TableRows['documents']>(tableNames.documents).insert({
|
||||
metadata: {},
|
||||
type: 'raw',
|
||||
...document,
|
||||
content: base64ToMaybeBuffer(document.content),
|
||||
id,
|
||||
@@ -136,7 +134,7 @@ class DocumentsService extends EventEmitter<DocumentsServiceEvents> {
|
||||
source: null,
|
||||
sourceId: null,
|
||||
typeVersion: null,
|
||||
metadata: {},
|
||||
metadata: null,
|
||||
...document,
|
||||
content: base64ToMaybeBuffer(document.content) || null,
|
||||
deletedAt: null,
|
||||
|
||||
Reference in New Issue
Block a user