mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-20 10:28:15 +00:00
* server DB migration to add persistence flag needed by ephemeral mode feature When Mobile Ephemeral Mode is enabled by an admin, database persistence using SQLite for a particular server is not always the case. If Zero Persistence mode is setup by an admin, the app won't persist anything on a disk backed database. If Offline wiping is setup for a particular server then, when the app is considered to be offline after a certain period of time the server databased is completely wiped. To accommodate these two local persistence new modes and make the UI react accordingly, a new flag is now added to the app database (since server database may not exist) with different enumerated values depending on server mandated settings. * Update types/database/models/app/servers.ts Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com> * adds test for updating the persistence flag --------- Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Model} from '@nozbe/watermelondb';
|
|
import {field} from '@nozbe/watermelondb/decorators';
|
|
|
|
import {MM_TABLES} from '@constants/database';
|
|
|
|
import type {default as ServersModelInterface, PersistenceFlag} from '@typings/database/models/app/servers';
|
|
|
|
const {SERVERS} = MM_TABLES.APP;
|
|
|
|
/**
|
|
* The Server model will help us to identify the various servers a user will log in; in the context of
|
|
* multi-server support system. The db_path field will hold the App-Groups file-path
|
|
*/
|
|
export default class ServersModel extends Model implements ServersModelInterface {
|
|
/** table (name) : servers */
|
|
static table = SERVERS;
|
|
|
|
/** db_path : The file path where the database is stored */
|
|
@field('db_path') dbPath!: string;
|
|
|
|
/** display_name : The server display name */
|
|
@field('display_name') displayName!: string;
|
|
|
|
/** url : The online address for the Mattermost server */
|
|
@field('url') url!: string;
|
|
|
|
/** last_active_at: The last time this server was active */
|
|
@field('last_active_at') lastActiveAt!: number;
|
|
|
|
/** identifier: Determines the installation identifier of a server */
|
|
@field('identifier') identifier!: string;
|
|
|
|
/** persistence_flag: Marker for non-default persistence behavior on this server's local database */
|
|
@field('persistence_flag') persistenceFlag!: PersistenceFlag;
|
|
}
|