From 1b31c807524d17022a9d8178a44ea8419f8493b8 Mon Sep 17 00:00:00 2001 From: Zyrouge Date: Fri, 27 Dec 2024 22:26:08 +0530 Subject: [PATCH] chore: add room schema migrations --- .gitignore | 2 - .../1.json | 166 ++++++++++++++++++ .../2.json | 166 ++++++++++++++++++ .../1.json | 58 ++++++ 4 files changed, 390 insertions(+), 2 deletions(-) create mode 100644 app/room-schemas/io.github.zyrouge.symphony.services.database.CacheDatabase/1.json create mode 100644 app/room-schemas/io.github.zyrouge.symphony.services.database.CacheDatabase/2.json create mode 100644 app/room-schemas/io.github.zyrouge.symphony.services.database.PersistentDatabase/1.json diff --git a/.gitignore b/.gitignore index 81b4c3a4..8ecf702f 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,3 @@ app/src/main/assets/i18n dist secrets .kotlin -app/room-schemas/ - diff --git a/app/room-schemas/io.github.zyrouge.symphony.services.database.CacheDatabase/1.json b/app/room-schemas/io.github.zyrouge.symphony.services.database.CacheDatabase/1.json new file mode 100644 index 00000000..cee3087d --- /dev/null +++ b/app/room-schemas/io.github.zyrouge.symphony.services.database.CacheDatabase/1.json @@ -0,0 +1,166 @@ +{ + "formatVersion": 1, + "database": { + "version": 1, + "identityHash": "03822e08bb41204b4a0237835b616d5b", + "entities": [ + { + "tableName": "songs", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `title` TEXT NOT NULL, `album` TEXT, `artists` TEXT NOT NULL, `composers` TEXT NOT NULL, `albumArtists` TEXT NOT NULL, `genres` TEXT NOT NULL, `trackNumber` INTEGER, `trackTotal` INTEGER, `discNumber` INTEGER, `discTotal` INTEGER, `date` TEXT, `year` INTEGER, `duration` INTEGER NOT NULL, `bitrate` INTEGER, `samplingRate` INTEGER, `channels` INTEGER, `encoder` TEXT, `dateModified` INTEGER NOT NULL, `size` INTEGER NOT NULL, `coverFile` TEXT, `uri` TEXT NOT NULL, `path` TEXT NOT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "title", + "columnName": "title", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "album", + "columnName": "album", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "artists", + "columnName": "artists", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "composers", + "columnName": "composers", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "albumArtists", + "columnName": "albumArtists", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "genres", + "columnName": "genres", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "trackNumber", + "columnName": "trackNumber", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "trackTotal", + "columnName": "trackTotal", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "discNumber", + "columnName": "discNumber", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "discTotal", + "columnName": "discTotal", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "date", + "columnName": "date", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "year", + "columnName": "year", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "duration", + "columnName": "duration", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "bitrate", + "columnName": "bitrate", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "samplingRate", + "columnName": "samplingRate", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "channels", + "columnName": "channels", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "encoder", + "columnName": "encoder", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dateModified", + "columnName": "dateModified", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "size", + "columnName": "size", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "coverFile", + "columnName": "coverFile", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "path", + "columnName": "path", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "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, '03822e08bb41204b4a0237835b616d5b')" + ] + } +} \ No newline at end of file diff --git a/app/room-schemas/io.github.zyrouge.symphony.services.database.CacheDatabase/2.json b/app/room-schemas/io.github.zyrouge.symphony.services.database.CacheDatabase/2.json new file mode 100644 index 00000000..9fb5d4e4 --- /dev/null +++ b/app/room-schemas/io.github.zyrouge.symphony.services.database.CacheDatabase/2.json @@ -0,0 +1,166 @@ +{ + "formatVersion": 1, + "database": { + "version": 2, + "identityHash": "03822e08bb41204b4a0237835b616d5b", + "entities": [ + { + "tableName": "songs", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `title` TEXT NOT NULL, `album` TEXT, `artists` TEXT NOT NULL, `composers` TEXT NOT NULL, `albumArtists` TEXT NOT NULL, `genres` TEXT NOT NULL, `trackNumber` INTEGER, `trackTotal` INTEGER, `discNumber` INTEGER, `discTotal` INTEGER, `date` TEXT, `year` INTEGER, `duration` INTEGER NOT NULL, `bitrate` INTEGER, `samplingRate` INTEGER, `channels` INTEGER, `encoder` TEXT, `dateModified` INTEGER NOT NULL, `size` INTEGER NOT NULL, `coverFile` TEXT, `uri` TEXT NOT NULL, `path` TEXT NOT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "title", + "columnName": "title", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "album", + "columnName": "album", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "artists", + "columnName": "artists", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "composers", + "columnName": "composers", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "albumArtists", + "columnName": "albumArtists", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "genres", + "columnName": "genres", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "trackNumber", + "columnName": "trackNumber", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "trackTotal", + "columnName": "trackTotal", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "discNumber", + "columnName": "discNumber", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "discTotal", + "columnName": "discTotal", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "date", + "columnName": "date", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "year", + "columnName": "year", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "duration", + "columnName": "duration", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "bitrate", + "columnName": "bitrate", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "samplingRate", + "columnName": "samplingRate", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "channels", + "columnName": "channels", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "encoder", + "columnName": "encoder", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dateModified", + "columnName": "dateModified", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "size", + "columnName": "size", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "coverFile", + "columnName": "coverFile", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "path", + "columnName": "path", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "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, '03822e08bb41204b4a0237835b616d5b')" + ] + } +} \ No newline at end of file diff --git a/app/room-schemas/io.github.zyrouge.symphony.services.database.PersistentDatabase/1.json b/app/room-schemas/io.github.zyrouge.symphony.services.database.PersistentDatabase/1.json new file mode 100644 index 00000000..c8c278c3 --- /dev/null +++ b/app/room-schemas/io.github.zyrouge.symphony.services.database.PersistentDatabase/1.json @@ -0,0 +1,58 @@ +{ + "formatVersion": 1, + "database": { + "version": 1, + "identityHash": "6091615e6ae35543e127d6744215fad8", + "entities": [ + { + "tableName": "playlists", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `title` TEXT NOT NULL, `songPaths` TEXT NOT NULL, `uri` TEXT, `path` TEXT, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "title", + "columnName": "title", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "songPaths", + "columnName": "songPaths", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "uri", + "columnName": "uri", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "path", + "columnName": "path", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "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, '6091615e6ae35543e127d6744215fad8')" + ] + } +} \ No newline at end of file