2019-09-16 20:26:32 +00:00
|
|
|
import { appSchema, tableSchema } from '@nozbe/watermelondb';
|
|
|
|
|
|
|
|
export default appSchema({
|
2023-11-17 18:48:32 +00:00
|
|
|
version: 23,
|
2019-09-16 20:26:32 +00:00
|
|
|
tables: [
|
|
|
|
tableSchema({
|
|
|
|
name: 'subscriptions',
|
|
|
|
columns: [
|
|
|
|
{ name: '_id', type: 'string' },
|
|
|
|
{ name: 'f', type: 'boolean' },
|
|
|
|
{ name: 't', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'ts', type: 'number' },
|
|
|
|
{ name: 'ls', type: 'number' },
|
|
|
|
{ name: 'name', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'fname', type: 'string' },
|
2023-05-29 15:03:24 +00:00
|
|
|
{ name: 'sanitized_fname', type: 'string', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'rid', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'open', type: 'boolean' },
|
|
|
|
{ name: 'alert', type: 'boolean' },
|
|
|
|
{ name: 'roles', type: 'string', isOptional: true },
|
|
|
|
{ name: 'unread', type: 'number' },
|
|
|
|
{ name: 'user_mentions', type: 'number' },
|
2020-07-29 20:49:08 +00:00
|
|
|
{ name: 'group_mentions', type: 'number' },
|
2020-10-30 17:35:07 +00:00
|
|
|
{ name: 'tunread', type: 'string', isOptional: true },
|
|
|
|
{ name: 'tunread_user', type: 'string', isOptional: true },
|
|
|
|
{ name: 'tunread_group', type: 'string', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'room_updated_at', type: 'number' },
|
|
|
|
{ name: 'ro', type: 'boolean' },
|
|
|
|
{ name: 'last_open', type: 'number', isOptional: true },
|
|
|
|
{ name: 'last_message', type: 'string', isOptional: true },
|
|
|
|
{ name: 'description', type: 'string', isOptional: true },
|
|
|
|
{ name: 'announcement', type: 'string', isOptional: true },
|
2020-05-08 12:57:04 +00:00
|
|
|
{ name: 'banner_closed', type: 'boolean', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'topic', type: 'string', isOptional: true },
|
|
|
|
{ name: 'blocked', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'blocker', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'react_when_read_only', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'archived', type: 'boolean' },
|
|
|
|
{ name: 'join_code_required', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'muted', type: 'string', isOptional: true },
|
2020-11-30 20:00:31 +00:00
|
|
|
{ name: 'ignored', type: 'string', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'broadcast', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'prid', type: 'string', isOptional: true },
|
|
|
|
{ name: 'draft_message', type: 'string', isOptional: true },
|
|
|
|
{ name: 'last_thread_sync', type: 'number', isOptional: true },
|
2019-09-18 17:32:12 +00:00
|
|
|
{ name: 'jitsi_timeout', type: 'number', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'auto_translate', type: 'boolean', isOptional: true },
|
2019-10-28 20:04:44 +00:00
|
|
|
{ name: 'auto_translate_language', type: 'string' },
|
2020-03-06 14:19:03 +00:00
|
|
|
{ name: 'hide_unread_status', type: 'boolean', isOptional: true },
|
2020-04-01 12:28:54 +00:00
|
|
|
{ name: 'sys_mes', type: 'string', isOptional: true },
|
|
|
|
{ name: 'uids', type: 'string', isOptional: true },
|
2020-05-08 17:36:10 +00:00
|
|
|
{ name: 'usernames', type: 'string', isOptional: true },
|
|
|
|
{ name: 'visitor', type: 'string', isOptional: true },
|
|
|
|
{ name: 'department_id', type: 'string', isOptional: true },
|
|
|
|
{ name: 'served_by', type: 'string', isOptional: true },
|
|
|
|
{ name: 'livechat_data', type: 'string', isOptional: true },
|
2020-09-11 14:31:38 +00:00
|
|
|
{ name: 'tags', type: 'string', isOptional: true },
|
|
|
|
{ name: 'e2e_key', type: 'string', isOptional: true },
|
2023-01-12 13:32:33 +00:00
|
|
|
{ name: 'e2e_suggested_key', type: 'string', isOptional: true },
|
2020-09-11 14:31:38 +00:00
|
|
|
{ name: 'encrypted', type: 'boolean', isOptional: true },
|
2020-10-30 13:51:04 +00:00
|
|
|
{ name: 'e2e_key_id', type: 'string', isOptional: true },
|
2021-04-07 18:31:25 +00:00
|
|
|
{ name: 'avatar_etag', type: 'string', isOptional: true },
|
|
|
|
{ name: 'team_id', type: 'string', isIndexed: true },
|
2022-04-15 02:27:36 +00:00
|
|
|
{ name: 'team_main', type: 'boolean', isOptional: true }, // Use `Q.notEq(true)` to get false or null
|
2022-04-20 20:53:11 +00:00
|
|
|
{ name: 'on_hold', type: 'boolean', isOptional: true },
|
2022-06-13 13:24:54 +00:00
|
|
|
{ name: 'source', type: 'string', isOptional: true },
|
2023-04-28 15:16:14 +00:00
|
|
|
{ name: 'hide_mention_status', type: 'boolean', isOptional: true },
|
2023-11-17 18:48:32 +00:00
|
|
|
{ name: 'users_count', type: 'number', isOptional: true },
|
|
|
|
{ name: 'unmuted', type: 'string', isOptional: true }
|
2019-09-16 20:26:32 +00:00
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'rooms',
|
|
|
|
columns: [
|
|
|
|
{ name: 'custom_fields', type: 'string' },
|
|
|
|
{ name: 'broadcast', type: 'boolean' },
|
|
|
|
{ name: 'encrypted', type: 'boolean' },
|
2020-05-08 17:36:10 +00:00
|
|
|
{ name: 'ro', type: 'boolean' },
|
|
|
|
{ name: 'v', type: 'string', isOptional: true },
|
|
|
|
{ name: 'department_id', type: 'string', isOptional: true },
|
|
|
|
{ name: 'served_by', type: 'string', isOptional: true },
|
|
|
|
{ name: 'livechat_data', type: 'string', isOptional: true },
|
2020-09-11 14:31:38 +00:00
|
|
|
{ name: 'tags', type: 'string', isOptional: true },
|
2020-10-30 13:51:04 +00:00
|
|
|
{ name: 'e2e_key_id', type: 'string', isOptional: true },
|
|
|
|
{ name: 'avatar_etag', type: 'string', isOptional: true }
|
2019-09-16 20:26:32 +00:00
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'messages',
|
|
|
|
columns: [
|
|
|
|
{ name: 'msg', type: 'string', isOptional: true },
|
|
|
|
{ name: 't', type: 'string', isOptional: true },
|
|
|
|
{ name: 'rid', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'ts', type: 'number' },
|
|
|
|
{ name: 'u', type: 'string' },
|
|
|
|
{ name: 'alias', type: 'string' },
|
|
|
|
{ name: 'parse_urls', type: 'string' },
|
|
|
|
{ name: 'groupable', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'avatar', type: 'string', isOptional: true },
|
2020-05-08 17:16:22 +00:00
|
|
|
{ name: 'emoji', type: 'string', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'attachments', type: 'string', isOptional: true },
|
|
|
|
{ name: 'urls', type: 'string', isOptional: true },
|
|
|
|
{ name: '_updated_at', type: 'number' },
|
|
|
|
{ name: 'status', type: 'number', isOptional: true },
|
|
|
|
{ name: 'pinned', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'starred', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'edited_by', type: 'string', isOptional: true },
|
|
|
|
{ name: 'reactions', type: 'string', isOptional: true },
|
|
|
|
{ name: 'role', type: 'string', isOptional: true },
|
|
|
|
{ name: 'drid', type: 'string', isOptional: true },
|
|
|
|
{ name: 'dcount', type: 'number', isOptional: true },
|
|
|
|
{ name: 'dlm', type: 'number', isOptional: true },
|
|
|
|
{ name: 'tmid', type: 'string', isOptional: true },
|
|
|
|
{ name: 'tcount', type: 'number', isOptional: true },
|
|
|
|
{ name: 'tlm', type: 'number', isOptional: true },
|
|
|
|
{ name: 'replies', type: 'string', isOptional: true },
|
|
|
|
{ name: 'mentions', type: 'string', isOptional: true },
|
|
|
|
{ name: 'channels', type: 'string', isOptional: true },
|
|
|
|
{ name: 'unread', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'auto_translate', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'translations', type: 'string', isOptional: true },
|
2020-02-11 14:01:35 +00:00
|
|
|
{ name: 'tmsg', type: 'string', isOptional: true },
|
2020-09-11 14:31:38 +00:00
|
|
|
{ name: 'blocks', type: 'string', isOptional: true },
|
2020-10-30 17:35:07 +00:00
|
|
|
{ name: 'e2e', type: 'string', isOptional: true },
|
2021-10-20 16:32:58 +00:00
|
|
|
{ name: 'tshow', type: 'boolean', isOptional: true },
|
2022-04-20 20:53:11 +00:00
|
|
|
{ name: 'md', type: 'string', isOptional: true },
|
|
|
|
{ name: 'comment', type: 'string', isOptional: true }
|
2019-09-16 20:26:32 +00:00
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'threads',
|
|
|
|
columns: [
|
|
|
|
{ name: 'msg', type: 'string', isOptional: true },
|
|
|
|
{ name: 't', type: 'string', isOptional: true },
|
|
|
|
{ name: 'rid', type: 'string', isIndexed: true },
|
|
|
|
{ name: '_updated_at', type: 'number' },
|
|
|
|
{ name: 'ts', type: 'number' },
|
|
|
|
{ name: 'u', type: 'string' },
|
|
|
|
{ name: 'alias', type: 'string', isOptional: true },
|
|
|
|
{ name: 'parse_urls', type: 'string', isOptional: true },
|
|
|
|
{ name: 'groupable', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'avatar', type: 'string', isOptional: true },
|
2020-05-08 17:16:22 +00:00
|
|
|
{ name: 'emoji', type: 'string', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'attachments', type: 'string', isOptional: true },
|
|
|
|
{ name: 'urls', type: 'string', isOptional: true },
|
|
|
|
{ name: 'status', type: 'number', isOptional: true },
|
|
|
|
{ name: 'pinned', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'starred', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'edited_by', type: 'string', isOptional: true },
|
|
|
|
{ name: 'reactions', type: 'string', isOptional: true },
|
|
|
|
{ name: 'role', type: 'string', isOptional: true },
|
|
|
|
{ name: 'drid', type: 'string', isOptional: true },
|
|
|
|
{ name: 'dcount', type: 'number', isOptional: true },
|
|
|
|
{ name: 'dlm', type: 'number', isOptional: true },
|
|
|
|
{ name: 'tmid', type: 'string', isOptional: true },
|
|
|
|
{ name: 'tcount', type: 'number', isOptional: true },
|
|
|
|
{ name: 'tlm', type: 'number', isOptional: true },
|
|
|
|
{ name: 'replies', type: 'string', isOptional: true },
|
|
|
|
{ name: 'mentions', type: 'string', isOptional: true },
|
|
|
|
{ name: 'channels', type: 'string', isOptional: true },
|
|
|
|
{ name: 'unread', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'auto_translate', type: 'boolean', isOptional: true },
|
2020-09-11 14:31:38 +00:00
|
|
|
{ name: 'translations', type: 'string', isOptional: true },
|
2022-03-02 14:18:01 +00:00
|
|
|
{ name: 'e2e', type: 'string', isOptional: true },
|
|
|
|
{ name: 'draft_message', type: 'string', isOptional: true }
|
2019-09-16 20:26:32 +00:00
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'thread_messages',
|
|
|
|
columns: [
|
|
|
|
{ name: 'msg', type: 'string', isOptional: true },
|
|
|
|
{ name: 't', type: 'string', isOptional: true },
|
|
|
|
{ name: 'rid', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'subscription_id', type: 'string', isIndexed: true },
|
|
|
|
{ name: '_updated_at', type: 'number' },
|
|
|
|
{ name: 'ts', type: 'number' },
|
|
|
|
{ name: 'u', type: 'string' },
|
|
|
|
{ name: 'alias', type: 'string', isOptional: true },
|
|
|
|
{ name: 'parse_urls', type: 'string', isOptional: true },
|
|
|
|
{ name: 'groupable', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'avatar', type: 'string', isOptional: true },
|
2020-05-08 17:16:22 +00:00
|
|
|
{ name: 'emoji', type: 'string', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'attachments', type: 'string', isOptional: true },
|
|
|
|
{ name: 'urls', type: 'string', isOptional: true },
|
|
|
|
{ name: 'status', type: 'number', isOptional: true },
|
|
|
|
{ name: 'pinned', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'starred', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'edited_by', type: 'string', isOptional: true },
|
|
|
|
{ name: 'reactions', type: 'string', isOptional: true },
|
|
|
|
{ name: 'role', type: 'string', isOptional: true },
|
|
|
|
{ name: 'drid', type: 'string', isOptional: true },
|
|
|
|
{ name: 'dcount', type: 'number', isOptional: true },
|
|
|
|
{ name: 'dlm', type: 'number', isOptional: true },
|
|
|
|
{ name: 'tcount', type: 'number', isOptional: true },
|
|
|
|
{ name: 'tlm', type: 'number', isOptional: true },
|
|
|
|
{ name: 'replies', type: 'string', isOptional: true },
|
|
|
|
{ name: 'mentions', type: 'string', isOptional: true },
|
|
|
|
{ name: 'channels', type: 'string', isOptional: true },
|
|
|
|
{ name: 'unread', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'auto_translate', type: 'boolean', isOptional: true },
|
2020-09-11 14:31:38 +00:00
|
|
|
{ name: 'translations', type: 'string', isOptional: true },
|
|
|
|
{ name: 'e2e', type: 'string', isOptional: true }
|
2019-09-16 20:26:32 +00:00
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'custom_emojis',
|
|
|
|
columns: [
|
|
|
|
{ name: 'name', type: 'string', isOptional: true },
|
|
|
|
{ name: 'aliases', type: 'string', isOptional: true },
|
|
|
|
{ name: 'extension', type: 'string' },
|
|
|
|
{ name: '_updated_at', type: 'number' }
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'frequently_used_emojis',
|
|
|
|
columns: [
|
|
|
|
{ name: 'content', type: 'string', isOptional: true },
|
|
|
|
{ name: 'extension', type: 'string', isOptional: true },
|
|
|
|
{ name: 'is_custom', type: 'boolean' },
|
|
|
|
{ name: 'count', type: 'number' }
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'uploads',
|
|
|
|
columns: [
|
|
|
|
{ name: 'path', type: 'string', isOptional: true },
|
|
|
|
{ name: 'rid', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'name', type: 'string', isOptional: true },
|
2022-12-21 17:34:48 +00:00
|
|
|
{ name: 'tmid', type: 'string', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: 'description', type: 'string', isOptional: true },
|
|
|
|
{ name: 'size', type: 'number' },
|
|
|
|
{ name: 'type', type: 'string', isOptional: true },
|
|
|
|
{ name: 'store', type: 'string', isOptional: true },
|
|
|
|
{ name: 'progress', type: 'number' },
|
|
|
|
{ name: 'error', type: 'boolean' }
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'settings',
|
|
|
|
columns: [
|
|
|
|
{ name: 'value_as_string', type: 'string', isOptional: true },
|
|
|
|
{ name: 'value_as_boolean', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'value_as_number', type: 'number', isOptional: true },
|
2020-02-20 20:43:56 +00:00
|
|
|
{ name: 'value_as_array', type: 'string', isOptional: true },
|
2019-09-16 20:26:32 +00:00
|
|
|
{ name: '_updated_at', type: 'number', isOptional: true }
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'roles',
|
2021-09-13 20:41:05 +00:00
|
|
|
columns: [{ name: 'description', type: 'string', isOptional: true }]
|
2019-09-16 20:26:32 +00:00
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'permissions',
|
|
|
|
columns: [
|
|
|
|
{ name: 'roles', type: 'string' },
|
|
|
|
{ name: '_updated_at', type: 'number', isOptional: true }
|
|
|
|
]
|
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'slash_commands',
|
|
|
|
columns: [
|
|
|
|
{ name: 'params', type: 'string', isOptional: true },
|
|
|
|
{ name: 'description', type: 'string', isOptional: true },
|
|
|
|
{ name: 'client_only', type: 'boolean', isOptional: true },
|
2020-02-11 14:01:35 +00:00
|
|
|
{ name: 'provides_preview', type: 'boolean', isOptional: true },
|
|
|
|
{ name: 'app_id', type: 'string', isOptional: true }
|
2019-09-16 20:26:32 +00:00
|
|
|
]
|
2020-10-30 13:12:02 +00:00
|
|
|
}),
|
|
|
|
tableSchema({
|
|
|
|
name: 'users',
|
|
|
|
columns: [
|
|
|
|
{ name: '_id', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'name', type: 'string', isOptional: true },
|
|
|
|
{ name: 'username', type: 'string', isIndexed: true },
|
|
|
|
{ name: 'avatar_etag', type: 'string', isOptional: true }
|
|
|
|
]
|
2019-09-16 20:26:32 +00:00
|
|
|
})
|
|
|
|
]
|
|
|
|
});
|