Add db column

This commit is contained in:
Diego Mello 2024-02-21 16:34:18 -03:00
parent 1e018fbe30
commit 9a1f78211c
3 changed files with 16 additions and 3 deletions

View File

@ -145,6 +145,8 @@ export default class Subscription extends Model {
@json('source', sanitizer) source; @json('source', sanitizer) source;
@field('disable_notifications') disableNotifications;
asPlain() { asPlain() {
return { return {
_id: this._id, _id: this._id,
@ -207,7 +209,8 @@ export default class Subscription extends Model {
teamMain: this.teamMain, teamMain: this.teamMain,
onHold: this.onHold, onHold: this.onHold,
usersCount: this.usersCount, usersCount: this.usersCount,
source: this.source source: this.source,
disableNotifications: this.disableNotifications
}; };
} }
} }

View File

@ -284,6 +284,15 @@ export default schemaMigrations({
columns: [{ name: 'unmuted', type: 'string', isOptional: true }] columns: [{ name: 'unmuted', type: 'string', isOptional: true }]
}) })
] ]
},
{
toVersion: 24,
steps: [
addColumns({
table: 'subscriptions',
columns: [{ name: 'disable_notifications', type: 'boolean', isOptional: true }]
})
]
} }
] ]
}); });

View File

@ -1,7 +1,7 @@
import { appSchema, tableSchema } from '@nozbe/watermelondb'; import { appSchema, tableSchema } from '@nozbe/watermelondb';
export default appSchema({ export default appSchema({
version: 23, version: 24,
tables: [ tables: [
tableSchema({ tableSchema({
name: 'subscriptions', name: 'subscriptions',
@ -66,7 +66,8 @@ export default appSchema({
{ name: 'source', type: 'string', isOptional: true }, { name: 'source', type: 'string', isOptional: true },
{ name: 'hide_mention_status', type: 'boolean', isOptional: true }, { name: 'hide_mention_status', type: 'boolean', isOptional: true },
{ name: 'users_count', type: 'number', isOptional: true }, { name: 'users_count', type: 'number', isOptional: true },
{ name: 'unmuted', type: 'string', isOptional: true } { name: 'unmuted', type: 'string', isOptional: true },
{ name: 'disable_notifications', type: 'boolean', isOptional: true }
] ]
}), }),
tableSchema({ tableSchema({