mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Server: Add function to get db default value
This commit is contained in:
parent
6cdb1a714a
commit
6962ba115e
Binary file not shown.
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user