diff --git a/app/schemas/io.heckel.ntfy.data.Database/7.json b/app/schemas/io.heckel.ntfy.data.Database/7.json deleted file mode 100644 index 4c336c1..0000000 --- a/app/schemas/io.heckel.ntfy.data.Database/7.json +++ /dev/null @@ -1,206 +0,0 @@ -{ - "formatVersion": 1, - "database": { - "version": 7, - "identityHash": "fc725df9153ee7088ae8024428b7f2cf", - "entities": [ - { - "tableName": "Subscription", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `baseUrl` TEXT NOT NULL, `topic` TEXT NOT NULL, `instant` INTEGER NOT NULL, `mutedUntil` INTEGER NOT NULL, `upAppId` TEXT, `upConnectorToken` TEXT, PRIMARY KEY(`id`))", - "fields": [ - { - "fieldPath": "id", - "columnName": "id", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "baseUrl", - "columnName": "baseUrl", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "topic", - "columnName": "topic", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "instant", - "columnName": "instant", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "mutedUntil", - "columnName": "mutedUntil", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "upAppId", - "columnName": "upAppId", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "upConnectorToken", - "columnName": "upConnectorToken", - "affinity": "TEXT", - "notNull": false - } - ], - "primaryKey": { - "columnNames": [ - "id" - ], - "autoGenerate": false - }, - "indices": [ - { - "name": "index_Subscription_baseUrl_topic", - "unique": true, - "columnNames": [ - "baseUrl", - "topic" - ], - "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Subscription_baseUrl_topic` ON `${TABLE_NAME}` (`baseUrl`, `topic`)" - }, - { - "name": "index_Subscription_upConnectorToken", - "unique": true, - "columnNames": [ - "upConnectorToken" - ], - "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_Subscription_upConnectorToken` ON `${TABLE_NAME}` (`upConnectorToken`)" - } - ], - "foreignKeys": [] - }, - { - "tableName": "Notification", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `subscriptionId` INTEGER NOT NULL, `timestamp` INTEGER NOT NULL, `title` TEXT NOT NULL, `message` TEXT NOT NULL, `notificationId` INTEGER NOT NULL, `priority` INTEGER NOT NULL DEFAULT 3, `tags` TEXT NOT NULL, `click` TEXT NOT NULL, `deleted` INTEGER NOT NULL, `attachment_name` TEXT, `attachment_type` TEXT, `attachment_size` INTEGER, `attachment_expires` INTEGER, `attachment_url` TEXT, `attachment_contentUri` TEXT, `attachment_progress` INTEGER, PRIMARY KEY(`id`, `subscriptionId`))", - "fields": [ - { - "fieldPath": "id", - "columnName": "id", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "subscriptionId", - "columnName": "subscriptionId", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "timestamp", - "columnName": "timestamp", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "title", - "columnName": "title", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "message", - "columnName": "message", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "notificationId", - "columnName": "notificationId", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "priority", - "columnName": "priority", - "affinity": "INTEGER", - "notNull": true, - "defaultValue": "3" - }, - { - "fieldPath": "tags", - "columnName": "tags", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "click", - "columnName": "click", - "affinity": "TEXT", - "notNull": true - }, - { - "fieldPath": "deleted", - "columnName": "deleted", - "affinity": "INTEGER", - "notNull": true - }, - { - "fieldPath": "attachment.name", - "columnName": "attachment_name", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "attachment.type", - "columnName": "attachment_type", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "attachment.size", - "columnName": "attachment_size", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "attachment.expires", - "columnName": "attachment_expires", - "affinity": "INTEGER", - "notNull": false - }, - { - "fieldPath": "attachment.url", - "columnName": "attachment_url", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "attachment.contentUri", - "columnName": "attachment_contentUri", - "affinity": "TEXT", - "notNull": false - }, - { - "fieldPath": "attachment.progress", - "columnName": "attachment_progress", - "affinity": "INTEGER", - "notNull": false - } - ], - "primaryKey": { - "columnNames": [ - "id", - "subscriptionId" - ], - "autoGenerate": false - }, - "indices": [], - "foreignKeys": [] - } - ], - "views": [], - "setupQueries": [ - "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'fc725df9153ee7088ae8024428b7f2cf')" - ] - } -} \ No newline at end of file diff --git a/app/src/main/java/io/heckel/ntfy/data/Database.kt b/app/src/main/java/io/heckel/ntfy/data/Database.kt index a53568e..9384acc 100644 --- a/app/src/main/java/io/heckel/ntfy/data/Database.kt +++ b/app/src/main/java/io/heckel/ntfy/data/Database.kt @@ -77,7 +77,7 @@ const val PROGRESS_FAILED = -3 const val PROGRESS_DELETED = -4 const val PROGRESS_DONE = 100 -@androidx.room.Database(entities = [Subscription::class, Notification::class], version = 7) +@androidx.room.Database(entities = [Subscription::class, Notification::class], version = 6) abstract class Database : RoomDatabase() { abstract fun subscriptionDao(): SubscriptionDao abstract fun notificationDao(): NotificationDao @@ -95,7 +95,6 @@ abstract class Database : RoomDatabase() { .addMigrations(MIGRATION_3_4) .addMigrations(MIGRATION_4_5) .addMigrations(MIGRATION_5_6) - .addMigrations(MIGRATION_6_7) .fallbackToDestructiveMigration() .build() this.instance = instance @@ -144,18 +143,13 @@ abstract class Database : RoomDatabase() { private val MIGRATION_5_6 = object : Migration(5, 6) { override fun migrate(db: SupportSQLiteDatabase) { db.execSQL("ALTER TABLE Notification ADD COLUMN click TEXT NOT NULL DEFAULT('')") - } - } - - private val MIGRATION_6_7 = object : Migration(6, 7) { - override fun migrate(db: SupportSQLiteDatabase) { - db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_name TEXT NOT NULL DEFAULT('')") + db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_name TEXT") // Room limitation: Has to be nullable for @Embedded db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_type TEXT") db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_size INT") db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_expires INT") - db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_url TEXT NOT NULL DEFAULT('')") + db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_url TEXT") // Room limitation: Has to be nullable for @Embedded db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_contentUri TEXT") - db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_progress INT NOT NULL DEFAULT('0')") + db.execSQL("ALTER TABLE Notification ADD COLUMN attachment_progress INT") // Room limitation: Has to be nullable for @Embedded } } }