diff --git a/packages/server/schema.sqlite b/packages/server/schema.sqlite index e1754d554..5543030e6 100644 Binary files a/packages/server/schema.sqlite and b/packages/server/schema.sqlite differ diff --git a/packages/server/src/services/database/types.ts b/packages/server/src/services/database/types.ts index c6ea08965..d4d3bc438 100644 --- a/packages/server/src/services/database/types.ts +++ b/packages/server/src/services/database/types.ts @@ -75,6 +75,14 @@ export function changeTypeToString(t: ChangeType): string { throw new Error(`Unkown type: ${t}`); } +export const getDefaultValue = (tableName: string, colName: string): string|number|null => { + const table = databaseSchema[tableName]; + if (!table) throw new Error(`Invalid table name: ${tableName}`); + const col = table[colName]; + if (!col) throw new Error(`Invalid column name: ${tableName}.${colName}`); + return col.defaultValue; +}; + export enum ShareType { Note = 1, // When a note is shared via a public link Folder = 3, // When a complete folder is shared with another Joplin Server user