mattermost-mobile-upstream/app/database/schema/server/table_schemas/index.ts
Guillermo Vayá 354e956f43 feat(drafts): Phase 1 synchronized-drafts storage foundation
Adds the durable storage foundation for synchronized drafts (mobile-only,
no network behavior yet):

- Fix draft batch dedup in handleDraft to key by the composite
  (channel_id, root_id) instead of channel_id alone, so a channel draft
  and its thread reply drafts in the same batch no longer collapse.
- Add Draft columns: server_update_at (nullable ancestry hint, not a
  revision), props (JSON), file_ids (JSON portable server attachment IDs).
- Add the DraftOutbox table (one durable pending op per draft key) with
  operation/status const objects, generation, keep_local, retry fields,
  and a deleted_fingerprint column for delete-vs-newer-write disambiguation.
- Add buildDraftOutboxId, the serialized mutateDraftAndOutbox writer
  primitive (enters database.write before querying both tables, commits one
  batch), and deterministic repairDuplicateDrafts.
- Bump server schema 20 -> 21 with addColumns + createTable migration;
  register schema/model in the database managers, mocks, types, and docs.

Tests: composite-key survival, concurrent-mutation serialization, batch
failure atomicity, duplicate repair winner, model round-trip / migration
compatibility, and migration definition.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 16:18:48 +02:00

43 lines
2.4 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
export {default as CategorySchema} from './category';
export {default as CategoryChannelSchema} from './category_channel';
export {default as ChannelSchema} from './channel';
export {default as ChannelBookmarkSchema} from './channel_bookmark';
export {default as ChannelInfoSchema} from './channel_info';
export {default as ChannelMembershipSchema} from './channel_membership';
export {default as CustomEmojiSchema} from './custom_emoji';
export {default as CustomProfileFieldSchema} from './custom_profile_field';
export {default as CustomProfileAttributeSchema} from './custom_profile_attribute';
export {default as DraftSchema} from './draft';
export {default as DraftOutboxSchema} from './draft_outbox';
export {default as FileSchema} from './file';
export {default as GroupSchema} from './group';
export {default as GroupChannelSchema} from './group_channel';
export {default as GroupTeamSchema} from './group_team';
export {default as GroupMembershipSchema} from './group_membership';
export {default as MyChannelSchema} from './my_channel';
export {default as MyChannelSettingsSchema} from './my_channel_settings';
export {default as MyTeamSchema} from './my_team';
export {default as PostInThreadSchema} from './posts_in_thread';
export {default as PostSchema} from './post';
export {default as PostsInChannelSchema} from './posts_in_channel';
export {default as PreferenceSchema} from './preference';
export {default as PropertyFieldSchema} from './property_field';
export {default as PropertyValueSchema} from './property_value';
export {default as ReactionSchema} from './reaction';
export {default as RoleSchema} from './role';
export {default as ScheduledPostSchema} from './scheduled_post';
export {default as SystemSchema} from './system';
export {default as TeamChannelHistorySchema} from './team_channel_history';
export {default as TeamMembershipSchema} from './team_membership';
export {default as TeamSchema} from './team';
export {default as TeamSearchHistorySchema} from './team_search_history';
export {default as ThreadSchema} from './thread';
export {default as ThreadParticipantSchema} from './thread_participant';
export {default as ThreadInTeamSchema} from './thread_in_team';
export {default as TeamThreadsSyncSchema} from './team_threads_sync';
export {default as UserSchema} from './user';
export {default as ConfigSchema} from './config';