forked from Ivasoft/mattermost-mobile
Move config to its own database table (#6744)
* Move config to its own database table * Address feedback * Fix test * Revert minimum version related changes
This commit is contained in:
committed by
GitHub
parent
887565423c
commit
1aa4188f8e
@@ -9,6 +9,7 @@ import {
|
||||
ChannelInfoSchema,
|
||||
ChannelMembershipSchema,
|
||||
ChannelSchema,
|
||||
ConfigSchema,
|
||||
CustomEmojiSchema,
|
||||
DraftSchema,
|
||||
FileSchema,
|
||||
@@ -37,13 +38,14 @@ import {
|
||||
} from './table_schemas';
|
||||
|
||||
export const serverSchema: AppSchema = appSchema({
|
||||
version: 4,
|
||||
version: 5,
|
||||
tables: [
|
||||
CategorySchema,
|
||||
CategoryChannelSchema,
|
||||
ChannelInfoSchema,
|
||||
ChannelMembershipSchema,
|
||||
ChannelSchema,
|
||||
ConfigSchema,
|
||||
CustomEmojiSchema,
|
||||
DraftSchema,
|
||||
FileSchema,
|
||||
|
||||
19
app/database/schema/server/table_schemas/config.ts
Normal file
19
app/database/schema/server/table_schemas/config.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {tableSchema} from '@nozbe/watermelondb';
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
|
||||
import type {TableSchemaSpec} from '@nozbe/watermelondb/Schema';
|
||||
|
||||
const {CONFIG} = MM_TABLES.SERVER;
|
||||
|
||||
export const tableSchemaSpec: TableSchemaSpec = {
|
||||
name: CONFIG,
|
||||
columns: [
|
||||
{name: 'value', type: 'string'},
|
||||
],
|
||||
};
|
||||
|
||||
export default tableSchema(tableSchemaSpec);
|
||||
@@ -31,3 +31,4 @@ export {default as ThreadSchema} from './thread';
|
||||
export {default as ThreadParticipantSchema} from './thread_participant';
|
||||
export {default as ThreadInTeamSchema} from './thread_in_team';
|
||||
export {default as UserSchema} from './user';
|
||||
export {default as ConfigSchema} from './config';
|
||||
|
||||
@@ -13,6 +13,7 @@ const {
|
||||
CHANNEL,
|
||||
CHANNEL_INFO,
|
||||
CHANNEL_MEMBERSHIP,
|
||||
CONFIG,
|
||||
CUSTOM_EMOJI,
|
||||
DRAFT,
|
||||
FILE,
|
||||
@@ -43,7 +44,8 @@ const {
|
||||
describe('*** Test schema for SERVER database ***', () => {
|
||||
it('=> The SERVER SCHEMA should strictly match', () => {
|
||||
expect(serverSchema).toEqual({
|
||||
version: 4,
|
||||
version: 5,
|
||||
unsafeSql: undefined,
|
||||
tables: {
|
||||
[CATEGORY]: {
|
||||
name: CATEGORY,
|
||||
@@ -145,6 +147,16 @@ describe('*** Test schema for SERVER database ***', () => {
|
||||
{name: 'scheme_admin', type: 'boolean'},
|
||||
],
|
||||
},
|
||||
[CONFIG]: {
|
||||
name: CONFIG,
|
||||
unsafeSql: undefined,
|
||||
columns: {
|
||||
value: {name: 'value', type: 'string'},
|
||||
},
|
||||
columnArray: [
|
||||
{name: 'value', type: 'string'},
|
||||
],
|
||||
},
|
||||
[CUSTOM_EMOJI]: {
|
||||
name: CUSTOM_EMOJI,
|
||||
unsafeSql: undefined,
|
||||
|
||||
Reference in New Issue
Block a user