mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-12 14:10:14 +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>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {type AppSchema, appSchema, tableSchema} from '@nozbe/watermelondb';
|
|
|
|
import {MM_TABLES} from '@constants/database';
|
|
|
|
const {INFO, GLOBAL, SERVERS} = MM_TABLES.APP;
|
|
|
|
export const schema: AppSchema = appSchema({
|
|
version: 2,
|
|
tables: [
|
|
tableSchema({
|
|
name: INFO,
|
|
columns: [
|
|
{name: 'build_number', type: 'string'},
|
|
{name: 'created_at', type: 'number'},
|
|
{name: 'version_number', type: 'string'},
|
|
],
|
|
}),
|
|
tableSchema({
|
|
name: GLOBAL,
|
|
columns: [
|
|
{name: 'value', type: 'string'},
|
|
],
|
|
}),
|
|
tableSchema({
|
|
name: SERVERS,
|
|
columns: [
|
|
{name: 'db_path', type: 'string'},
|
|
{name: 'display_name', type: 'string'},
|
|
{name: 'identifier', type: 'string', isIndexed: true},
|
|
{name: 'last_active_at', type: 'number', isIndexed: true},
|
|
{name: 'url', type: 'string', isIndexed: true},
|
|
{name: 'persistence_flag', type: 'string'},
|
|
],
|
|
}),
|
|
],
|
|
});
|