diff --git a/app/schemas/com.pranshulgg.weather_master_app.data.local.WeatherMasterDatabase/52.json b/app/schemas/com.pranshulgg.weather_master_app.data.local.WeatherMasterDatabase/52.json new file mode 100644 index 000000000..dea941379 --- /dev/null +++ b/app/schemas/com.pranshulgg.weather_master_app.data.local.WeatherMasterDatabase/52.json @@ -0,0 +1,1002 @@ +{ + "formatVersion": 1, + "database": { + "version": 52, + "identityHash": "537707fbe28970ba13ac6a3ad0640434", + "entities": [ + { + "tableName": "weather_locations", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `country` TEXT NOT NULL, `lat` REAL NOT NULL, `lon` REAL NOT NULL, `timezone` TEXT NOT NULL, `source` TEXT NOT NULL, `state` TEXT, `isFavorite` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL, `countryCode` TEXT, `isDefault` INTEGER NOT NULL, `isDeviceLocation` INTEGER NOT NULL, `alertSource` TEXT NOT NULL, `airQualitySource` TEXT NOT NULL, `customName` TEXT, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "country", + "columnName": "country", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "lat", + "columnName": "lat", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "lon", + "columnName": "lon", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "timezone", + "columnName": "timezone", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "source", + "columnName": "source", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "state", + "columnName": "state", + "affinity": "TEXT" + }, + { + "fieldPath": "isFavorite", + "columnName": "isFavorite", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "isPinned", + "columnName": "isPinned", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "countryCode", + "columnName": "countryCode", + "affinity": "TEXT" + }, + { + "fieldPath": "isDefault", + "columnName": "isDefault", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "isDeviceLocation", + "columnName": "isDeviceLocation", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "alertSource", + "columnName": "alertSource", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "airQualitySource", + "columnName": "airQualitySource", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "customName", + "columnName": "customName", + "affinity": "TEXT" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + } + }, + { + "tableName": "weather_current", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`locationId` TEXT NOT NULL, `temperature` REAL, `humidity` REAL NOT NULL, `windSpeed` REAL, `windDirection` TEXT, `pressureMsl` REAL, `visibility` INTEGER, `cloudCover` REAL, `uvIndex` REAL, `weatherCondition` TEXT NOT NULL, `feelsLike` REAL, `time` INTEGER NOT NULL, `dewPoint` REAL, `utcOffsetSeconds` INTEGER, `lastUpdatedInMilli` INTEGER NOT NULL, PRIMARY KEY(`locationId`), FOREIGN KEY(`locationId`) REFERENCES `weather_locations`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "locationId", + "columnName": "locationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "temperature", + "columnName": "temperature", + "affinity": "REAL" + }, + { + "fieldPath": "humidity", + "columnName": "humidity", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "windSpeed", + "columnName": "windSpeed", + "affinity": "REAL" + }, + { + "fieldPath": "windDirection", + "columnName": "windDirection", + "affinity": "TEXT" + }, + { + "fieldPath": "pressureMsl", + "columnName": "pressureMsl", + "affinity": "REAL" + }, + { + "fieldPath": "visibility", + "columnName": "visibility", + "affinity": "INTEGER" + }, + { + "fieldPath": "cloudCover", + "columnName": "cloudCover", + "affinity": "REAL" + }, + { + "fieldPath": "uvIndex", + "columnName": "uvIndex", + "affinity": "REAL" + }, + { + "fieldPath": "weatherCondition", + "columnName": "weatherCondition", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "feelsLike", + "columnName": "feelsLike", + "affinity": "REAL" + }, + { + "fieldPath": "time", + "columnName": "time", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "dewPoint", + "columnName": "dewPoint", + "affinity": "REAL" + }, + { + "fieldPath": "utcOffsetSeconds", + "columnName": "utcOffsetSeconds", + "affinity": "INTEGER" + }, + { + "fieldPath": "lastUpdatedInMilli", + "columnName": "lastUpdatedInMilli", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "locationId" + ] + }, + "indices": [ + { + "name": "index_weather_current_locationId", + "unique": false, + "columnNames": [ + "locationId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_weather_current_locationId` ON `${TABLE_NAME}` (`locationId`)" + } + ], + "foreignKeys": [ + { + "table": "weather_locations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "locationId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "weather_hourly", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`locationId` TEXT NOT NULL, `temperature` REAL, `windSpeed` REAL, `windDirection` TEXT, `rain` REAL NOT NULL, `snowfall` REAL, `uvIndex` REAL, `weatherCondition` TEXT NOT NULL, `pressureMsl` REAL, `visibility` INTEGER, `humidity` REAL, `dewPoint` REAL, `time` INTEGER NOT NULL, `precipitationProbability` INTEGER, PRIMARY KEY(`locationId`, `time`), FOREIGN KEY(`locationId`) REFERENCES `weather_locations`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "locationId", + "columnName": "locationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "temperature", + "columnName": "temperature", + "affinity": "REAL" + }, + { + "fieldPath": "windSpeed", + "columnName": "windSpeed", + "affinity": "REAL" + }, + { + "fieldPath": "windDirection", + "columnName": "windDirection", + "affinity": "TEXT" + }, + { + "fieldPath": "rain", + "columnName": "rain", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "snowfall", + "columnName": "snowfall", + "affinity": "REAL" + }, + { + "fieldPath": "uvIndex", + "columnName": "uvIndex", + "affinity": "REAL" + }, + { + "fieldPath": "weatherCondition", + "columnName": "weatherCondition", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "pressureMsl", + "columnName": "pressureMsl", + "affinity": "REAL" + }, + { + "fieldPath": "visibility", + "columnName": "visibility", + "affinity": "INTEGER" + }, + { + "fieldPath": "humidity", + "columnName": "humidity", + "affinity": "REAL" + }, + { + "fieldPath": "dewPoint", + "columnName": "dewPoint", + "affinity": "REAL" + }, + { + "fieldPath": "time", + "columnName": "time", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "precipitationProbability", + "columnName": "precipitationProbability", + "affinity": "INTEGER" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "locationId", + "time" + ] + }, + "indices": [ + { + "name": "index_weather_hourly_locationId", + "unique": false, + "columnNames": [ + "locationId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_weather_hourly_locationId` ON `${TABLE_NAME}` (`locationId`)" + } + ], + "foreignKeys": [ + { + "table": "weather_locations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "locationId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "weather_daily", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`locationId` TEXT NOT NULL, `temperatureMin` REAL, `temperatureMax` REAL, `windSpeed` REAL, `windDirection` TEXT, `rainSum` REAL NOT NULL, `snowfallSum` REAL, `uvIndexMax` REAL, `weatherCondition` TEXT NOT NULL, `time` INTEGER NOT NULL, `precipitationProbabilityMax` INTEGER, `pressureMsl` REAL, `visibility` INTEGER, `humidity` REAL, `dewPoint` REAL, `sunrise` INTEGER NOT NULL, `sunset` INTEGER NOT NULL, `moonrise` INTEGER NOT NULL, `moonset` INTEGER NOT NULL, `moonPhase` TEXT NOT NULL, `dawn` INTEGER NOT NULL, `dusk` INTEGER NOT NULL, PRIMARY KEY(`locationId`, `time`), FOREIGN KEY(`locationId`) REFERENCES `weather_locations`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "locationId", + "columnName": "locationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "temperatureMin", + "columnName": "temperatureMin", + "affinity": "REAL" + }, + { + "fieldPath": "temperatureMax", + "columnName": "temperatureMax", + "affinity": "REAL" + }, + { + "fieldPath": "windSpeed", + "columnName": "windSpeed", + "affinity": "REAL" + }, + { + "fieldPath": "windDirection", + "columnName": "windDirection", + "affinity": "TEXT" + }, + { + "fieldPath": "rainSum", + "columnName": "rainSum", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "snowfallSum", + "columnName": "snowfallSum", + "affinity": "REAL" + }, + { + "fieldPath": "uvIndexMax", + "columnName": "uvIndexMax", + "affinity": "REAL" + }, + { + "fieldPath": "weatherCondition", + "columnName": "weatherCondition", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "time", + "columnName": "time", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "precipitationProbabilityMax", + "columnName": "precipitationProbabilityMax", + "affinity": "INTEGER" + }, + { + "fieldPath": "pressureMsl", + "columnName": "pressureMsl", + "affinity": "REAL" + }, + { + "fieldPath": "visibility", + "columnName": "visibility", + "affinity": "INTEGER" + }, + { + "fieldPath": "humidity", + "columnName": "humidity", + "affinity": "REAL" + }, + { + "fieldPath": "dewPoint", + "columnName": "dewPoint", + "affinity": "REAL" + }, + { + "fieldPath": "sunrise", + "columnName": "sunrise", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sunset", + "columnName": "sunset", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "moonrise", + "columnName": "moonrise", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "moonset", + "columnName": "moonset", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "moonPhase", + "columnName": "moonPhase", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "dawn", + "columnName": "dawn", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "dusk", + "columnName": "dusk", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "locationId", + "time" + ] + }, + "indices": [ + { + "name": "index_weather_daily_locationId", + "unique": false, + "columnNames": [ + "locationId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_weather_daily_locationId` ON `${TABLE_NAME}` (`locationId`)" + } + ], + "foreignKeys": [ + { + "table": "weather_locations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "locationId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "weather_units", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `tempUnit` TEXT NOT NULL, `windUnit` TEXT NOT NULL, `distanceUnit` TEXT NOT NULL, `pressureUnit` TEXT NOT NULL, `precipitationUnit` TEXT NOT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "tempUnit", + "columnName": "tempUnit", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "windUnit", + "columnName": "windUnit", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "distanceUnit", + "columnName": "distanceUnit", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "pressureUnit", + "columnName": "pressureUnit", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "precipitationUnit", + "columnName": "precipitationUnit", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + } + }, + { + "tableName": "weather_blocks", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `isDaily` INTEGER NOT NULL, `type` TEXT NOT NULL, `isHidden` INTEGER NOT NULL, `position` INTEGER NOT NULL)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "isDaily", + "columnName": "isDaily", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "isHidden", + "columnName": "isHidden", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "position", + "columnName": "position", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + } + }, + { + "tableName": "air_quality_current", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`locationId` TEXT NOT NULL, `usAqi` INTEGER, `pm10` REAL, `pm25` REAL, `carbonMonoxide` REAL, `nitrogenDioxide` REAL, `sulphurDioxide` REAL, `ozone` REAL, `lastUpdatedInMilli` INTEGER NOT NULL, PRIMARY KEY(`locationId`), FOREIGN KEY(`locationId`) REFERENCES `weather_locations`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "locationId", + "columnName": "locationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "usAqi", + "columnName": "usAqi", + "affinity": "INTEGER" + }, + { + "fieldPath": "pm10", + "columnName": "pm10", + "affinity": "REAL" + }, + { + "fieldPath": "pm25", + "columnName": "pm25", + "affinity": "REAL" + }, + { + "fieldPath": "carbonMonoxide", + "columnName": "carbonMonoxide", + "affinity": "REAL" + }, + { + "fieldPath": "nitrogenDioxide", + "columnName": "nitrogenDioxide", + "affinity": "REAL" + }, + { + "fieldPath": "sulphurDioxide", + "columnName": "sulphurDioxide", + "affinity": "REAL" + }, + { + "fieldPath": "ozone", + "columnName": "ozone", + "affinity": "REAL" + }, + { + "fieldPath": "lastUpdatedInMilli", + "columnName": "lastUpdatedInMilli", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "locationId" + ] + }, + "indices": [ + { + "name": "index_air_quality_current_locationId", + "unique": false, + "columnNames": [ + "locationId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_air_quality_current_locationId` ON `${TABLE_NAME}` (`locationId`)" + } + ], + "foreignKeys": [ + { + "table": "weather_locations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "locationId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "nws_location_gridpoints", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`locationId` TEXT NOT NULL, `officeId` TEXT NOT NULL, `gridX` INTEGER NOT NULL, `gridY` INTEGER NOT NULL, `stationIdentifier` TEXT NOT NULL, `lastUpdatedMilli` INTEGER NOT NULL, PRIMARY KEY(`locationId`), FOREIGN KEY(`locationId`) REFERENCES `weather_locations`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "locationId", + "columnName": "locationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "officeId", + "columnName": "officeId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "gridX", + "columnName": "gridX", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "gridY", + "columnName": "gridY", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "stationIdentifier", + "columnName": "stationIdentifier", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "lastUpdatedMilli", + "columnName": "lastUpdatedMilli", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "locationId" + ] + }, + "indices": [ + { + "name": "index_nws_location_gridpoints_locationId", + "unique": false, + "columnNames": [ + "locationId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_nws_location_gridpoints_locationId` ON `${TABLE_NAME}` (`locationId`)" + } + ], + "foreignKeys": [ + { + "table": "weather_locations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "locationId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "github", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `currentTag` TEXT NOT NULL, `lastFetchedTag` TEXT NOT NULL, `lastFetchedTime` INTEGER NOT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "currentTag", + "columnName": "currentTag", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "lastFetchedTag", + "columnName": "lastFetchedTag", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "lastFetchedTime", + "columnName": "lastFetchedTime", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + } + }, + { + "tableName": "air_quality_hourly", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `locationId` TEXT NOT NULL, `pm10` REAL, `pm25` REAL, `carbonMonoxide` REAL, `nitrogenDioxide` REAL, `sulphurDioxide` REAL, `ozone` REAL, `time` INTEGER NOT NULL, FOREIGN KEY(`locationId`) REFERENCES `weather_locations`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "locationId", + "columnName": "locationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "pm10", + "columnName": "pm10", + "affinity": "REAL" + }, + { + "fieldPath": "pm25", + "columnName": "pm25", + "affinity": "REAL" + }, + { + "fieldPath": "carbonMonoxide", + "columnName": "carbonMonoxide", + "affinity": "REAL" + }, + { + "fieldPath": "nitrogenDioxide", + "columnName": "nitrogenDioxide", + "affinity": "REAL" + }, + { + "fieldPath": "sulphurDioxide", + "columnName": "sulphurDioxide", + "affinity": "REAL" + }, + { + "fieldPath": "ozone", + "columnName": "ozone", + "affinity": "REAL" + }, + { + "fieldPath": "time", + "columnName": "time", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_air_quality_hourly_locationId", + "unique": false, + "columnNames": [ + "locationId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_air_quality_hourly_locationId` ON `${TABLE_NAME}` (`locationId`)" + } + ], + "foreignKeys": [ + { + "table": "weather_locations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "locationId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "location_keys", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`locationId` TEXT NOT NULL, `cityKey` TEXT NOT NULL, PRIMARY KEY(`locationId`), FOREIGN KEY(`locationId`) REFERENCES `weather_locations`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "locationId", + "columnName": "locationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "cityKey", + "columnName": "cityKey", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "locationId" + ] + }, + "indices": [ + { + "name": "index_location_keys_locationId", + "unique": false, + "columnNames": [ + "locationId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_location_keys_locationId` ON `${TABLE_NAME}` (`locationId`)" + } + ], + "foreignKeys": [ + { + "table": "weather_locations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "locationId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "alerts", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `locationId` TEXT NOT NULL, `event` TEXT NOT NULL, `severity` TEXT, `effective` INTEGER, `expires` INTEGER, `description` TEXT NOT NULL, `source` TEXT, `lastUpdatedInMilli` INTEGER NOT NULL, FOREIGN KEY(`locationId`) REFERENCES `weather_locations`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "locationId", + "columnName": "locationId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "event", + "columnName": "event", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "severity", + "columnName": "severity", + "affinity": "TEXT" + }, + { + "fieldPath": "effective", + "columnName": "effective", + "affinity": "INTEGER" + }, + { + "fieldPath": "expires", + "columnName": "expires", + "affinity": "INTEGER" + }, + { + "fieldPath": "description", + "columnName": "description", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "source", + "columnName": "source", + "affinity": "TEXT" + }, + { + "fieldPath": "lastUpdatedInMilli", + "columnName": "lastUpdatedInMilli", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_alerts_locationId", + "unique": false, + "columnNames": [ + "locationId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_alerts_locationId` ON `${TABLE_NAME}` (`locationId`)" + } + ], + "foreignKeys": [ + { + "table": "weather_locations", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "locationId" + ], + "referencedColumns": [ + "id" + ] + } + ] + } + ], + "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, '537707fbe28970ba13ac6a3ad0640434')" + ] + } +} \ No newline at end of file diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/WeatherMasterDatabase.kt b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/WeatherMasterDatabase.kt index 8741479ea..0b5c50359 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/data/local/WeatherMasterDatabase.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/data/local/WeatherMasterDatabase.kt @@ -8,26 +8,26 @@ import androidx.room.RoomDatabase import androidx.room.migration.Migration import androidx.sqlite.db.SupportSQLiteDatabase import com.pranshulgg.weather_master_app.data.local.dao.airquality.AirQualityDao -import com.pranshulgg.weather_master_app.data.local.dao.airquality.accu.AccuDao import com.pranshulgg.weather_master_app.data.local.dao.alerts.AlertsDao import com.pranshulgg.weather_master_app.data.local.dao.github.GithubDao -import com.pranshulgg.weather_master_app.data.local.dao.weather.WeatherUnitsDao +import com.pranshulgg.weather_master_app.data.local.dao.location.LocationKeysDao import com.pranshulgg.weather_master_app.data.local.dao.location.LocationsDao import com.pranshulgg.weather_master_app.data.local.dao.weather.WeatherBlocksDao import com.pranshulgg.weather_master_app.data.local.dao.weather.WeatherDao +import com.pranshulgg.weather_master_app.data.local.dao.weather.WeatherUnitsDao import com.pranshulgg.weather_master_app.data.local.dao.weather.nws.NwsDao -import com.pranshulgg.weather_master_app.data.local.entity.weather.units.AppWeatherUnitsEntity import com.pranshulgg.weather_master_app.data.local.entity.airquality.CurrentAirQualityEntity import com.pranshulgg.weather_master_app.data.local.entity.airquality.HourlyAirQualityEntity -import com.pranshulgg.weather_master_app.data.local.entity.airquality.accu.AccuEntity import com.pranshulgg.weather_master_app.data.local.entity.alerts.AlertEntity import com.pranshulgg.weather_master_app.data.local.entity.github.GithubEntity +import com.pranshulgg.weather_master_app.data.local.entity.location.LocationKeyEntity +import com.pranshulgg.weather_master_app.data.local.entity.location.WeatherLocationEntity import com.pranshulgg.weather_master_app.data.local.entity.weather.CurrentWeatherEntity import com.pranshulgg.weather_master_app.data.local.entity.weather.DailyWeatherEntity import com.pranshulgg.weather_master_app.data.local.entity.weather.HourlyWeatherEntity import com.pranshulgg.weather_master_app.data.local.entity.weather.blocks.WeatherBlockEntity -import com.pranshulgg.weather_master_app.data.local.entity.location.WeatherLocationEntity import com.pranshulgg.weather_master_app.data.local.entity.weather.nws.NwsGridPointsEntity +import com.pranshulgg.weather_master_app.data.local.entity.weather.units.AppWeatherUnitsEntity @Database( entities = [ @@ -41,10 +41,10 @@ import com.pranshulgg.weather_master_app.data.local.entity.weather.nws.NwsGridPo NwsGridPointsEntity::class, GithubEntity::class, HourlyAirQualityEntity::class, - AccuEntity::class, + LocationKeyEntity::class, AlertEntity::class ], - version = 51, + version = 52, autoMigrations = [ AutoMigration(from = 39, to = 40), AutoMigration(from = 42, to = 43), @@ -66,7 +66,7 @@ abstract class WeatherMasterDatabase : RoomDatabase() { abstract fun nwsDao(): NwsDao abstract fun githubDao(): GithubDao - abstract fun accuDao(): AccuDao + abstract fun locationKeysDao(): LocationKeysDao abstract fun alertsDao(): AlertsDao @@ -81,7 +81,13 @@ abstract class WeatherMasterDatabase : RoomDatabase() { context.applicationContext, WeatherMasterDatabase::class.java, "weather_master.db" - ).addMigrations(MIGRATION_40_41, MIGRATION_41_42, MIGRATION_45_46, MIGRATION_46_47) + ).addMigrations( + MIGRATION_40_41, + MIGRATION_41_42, + MIGRATION_45_46, + MIGRATION_46_47, + MIGRATION_51_52 + ) .build() .also { INSTANCE = it } } @@ -166,4 +172,10 @@ val MIGRATION_46_47 = object : Migration(46, 47) { db.execSQL("ALTER TABLE weather_locations ADD COLUMN alertSource TEXT NOT NULL DEFAULT 'NONE'") db.execSQL("ALTER TABLE weather_locations ADD COLUMN airQualitySource TEXT NOT NULL DEFAULT 'OPEN_METEO'") } +} + +val MIGRATION_51_52 = object : Migration(51, 52) { + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE accu_locations RENAME TO location_keys") + } } \ No newline at end of file