From 9a1f78211c2be535c0a56c55a5b197436ff9f1ab Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 21 Feb 2024 16:34:18 -0300 Subject: [PATCH] Add db column --- app/lib/database/model/Subscription.js | 5 ++++- app/lib/database/model/migrations.js | 9 +++++++++ app/lib/database/schema/app.js | 5 +++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/lib/database/model/Subscription.js b/app/lib/database/model/Subscription.js index 59ade5c9e..cda8faa8f 100644 --- a/app/lib/database/model/Subscription.js +++ b/app/lib/database/model/Subscription.js @@ -145,6 +145,8 @@ export default class Subscription extends Model { @json('source', sanitizer) source; + @field('disable_notifications') disableNotifications; + asPlain() { return { _id: this._id, @@ -207,7 +209,8 @@ export default class Subscription extends Model { teamMain: this.teamMain, onHold: this.onHold, usersCount: this.usersCount, - source: this.source + source: this.source, + disableNotifications: this.disableNotifications }; } } diff --git a/app/lib/database/model/migrations.js b/app/lib/database/model/migrations.js index 08a111178..37b0b5123 100644 --- a/app/lib/database/model/migrations.js +++ b/app/lib/database/model/migrations.js @@ -284,6 +284,15 @@ export default schemaMigrations({ columns: [{ name: 'unmuted', type: 'string', isOptional: true }] }) ] + }, + { + toVersion: 24, + steps: [ + addColumns({ + table: 'subscriptions', + columns: [{ name: 'disable_notifications', type: 'boolean', isOptional: true }] + }) + ] } ] }); diff --git a/app/lib/database/schema/app.js b/app/lib/database/schema/app.js index 5ae48d6df..b0a99752b 100644 --- a/app/lib/database/schema/app.js +++ b/app/lib/database/schema/app.js @@ -1,7 +1,7 @@ import { appSchema, tableSchema } from '@nozbe/watermelondb'; export default appSchema({ - version: 23, + version: 24, tables: [ tableSchema({ name: 'subscriptions', @@ -66,7 +66,8 @@ export default appSchema({ { name: 'source', type: 'string', isOptional: true }, { name: 'hide_mention_status', type: 'boolean', 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({