Gekidou - Updated Server Database Diagrams/Schema/Models (#6119)

* started with the diagrams

* removed redundant tables

next step:
1. reconstruct id ( local id vs server id )
2. annotate fields with examples
3. recreate relationship

* work in progress

* work in progress

* fix association

* update postsInChannel

* removed SlashCommands from the Server database schema

* added missing associations in the models and updated docs/database

* exported server database

* update test

* code corrections following review

* update relationship

* update docs

* removed cyclic relationship

* Revert "removed cyclic relationship"

This reverts commit 4d784efb81.

* removed isOptional from Draft

* linked myChannelSettings to myChannel instead of Channel

* update diagrams

* store null instead of empty string

* update thread association

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Avinash Lingaloo
2022-04-07 18:14:28 +04:00
committed by GitHub
parent ae3c9e2ef2
commit 9a72837f04
38 changed files with 987 additions and 95 deletions

View File

@@ -9,7 +9,6 @@ import type ChannelInfoModel from './channel_info';
import type ChannelMembershipModel from './channel_membership';
import type DraftModel from './draft';
import type MyChannelModel from './my_channel';
import type MyChannelSettingsModel from './my_channel_settings';
import type PostModel from './post';
import type PostsInChannelModel from './posts_in_channel';
import type TeamModel from './team';
@@ -79,9 +78,6 @@ export default class ChannelModel extends Model {
/** membership : Query returning the membership data for the current user if it belongs to this channel */
membership: Relation<MyChannelModel>;
/** settings: User specific settings/preferences for this channel */
settings: Relation<MyChannelSettingsModel>;
/** categoryChannel: category of this channel */
categoryChannel: Relation<CategoryChannelModel>;

View File

@@ -26,7 +26,7 @@ export default class FileModel extends Model {
imageThumbnail: string;
/** local_path : Local path of the file that has been uploaded to server */
localPath: string;
localPath: string | null;
/** mime_type : The media type */
mimeType: string;

View File

@@ -5,9 +5,10 @@ import {Relation} from '@nozbe/watermelondb';
import Model from '@nozbe/watermelondb/Model';
import type ChannelModel from './channel';
import type MyChannelSettingsModel from './my_channel_settings';
/**
* MyChannel is an extension of the Channel model but it lists only the Channels the app's user belongs to
* MyChannel is an extension of the Channel model, but it lists only the Channels the app's user belongs to
*/
export default class MyChannelModel extends Model {
/** table (name) : MyChannel */
@@ -39,4 +40,7 @@ export default class MyChannelModel extends Model {
/** channel : The relation pointing to the CHANNEL table */
channel: Relation<ChannelModel>;
/** settings: User specific settings/preferences for this channel */
settings: Relation<MyChannelSettingsModel>;
}

View File

@@ -4,7 +4,7 @@
import {Relation} from '@nozbe/watermelondb';
import Model from '@nozbe/watermelondb/Model';
import type ChannelModel from './channel';
import type MyChannelModel from './my_channel';
/**
* The MyChannelSettings model represents the specific user's configuration to
@@ -17,6 +17,6 @@ export default class MyChannelSettingsModel extends Model {
/** notify_props : Configurations with regards to this channel */
notifyProps: Partial<ChannelNotifyProps>;
/** channel : The relation pointing to the CHANNEL table */
channel: Relation<ChannelModel>;
/** myChannel : The relation pointing to the MY_CHANNEL table */
myChannel: Relation<MyChannelModel>;
}