mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-16 13:44:26 +02:00
Enable database schema export and update Fastlane configuration
This commit is contained in:
@@ -0,0 +1,285 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 1,
|
||||||
|
"identityHash": "e9e1b3a9fbc321cf52bf869c01f5be21",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "User",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `birthDate` INTEGER NOT NULL, `gender` TEXT NOT NULL, `heightCm` REAL, `activityLevel` TEXT NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "birthDate",
|
||||||
|
"columnName": "birthDate",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gender",
|
||||||
|
"columnName": "gender",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "heightCm",
|
||||||
|
"columnName": "heightCm",
|
||||||
|
"affinity": "REAL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "activityLevel",
|
||||||
|
"columnName": "activityLevel",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "Measurement",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `userId` INTEGER NOT NULL, `timestamp` INTEGER NOT NULL, FOREIGN KEY(`userId`) REFERENCES `User`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "userId",
|
||||||
|
"columnName": "userId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "timestamp",
|
||||||
|
"columnName": "timestamp",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_Measurement_userId",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_Measurement_userId` ON `${TABLE_NAME}` (`userId`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "User",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"userId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "MeasurementValue",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `measurementId` INTEGER NOT NULL, `typeId` INTEGER NOT NULL, `floatValue` REAL, `intValue` INTEGER, `textValue` TEXT, `dateValue` INTEGER, FOREIGN KEY(`measurementId`) REFERENCES `Measurement`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`typeId`) REFERENCES `MeasurementType`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "measurementId",
|
||||||
|
"columnName": "measurementId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "typeId",
|
||||||
|
"columnName": "typeId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "floatValue",
|
||||||
|
"columnName": "floatValue",
|
||||||
|
"affinity": "REAL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "intValue",
|
||||||
|
"columnName": "intValue",
|
||||||
|
"affinity": "INTEGER"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "textValue",
|
||||||
|
"columnName": "textValue",
|
||||||
|
"affinity": "TEXT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "dateValue",
|
||||||
|
"columnName": "dateValue",
|
||||||
|
"affinity": "INTEGER"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_MeasurementValue_measurementId",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"measurementId"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_MeasurementValue_measurementId` ON `${TABLE_NAME}` (`measurementId`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_MeasurementValue_typeId",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"typeId"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_MeasurementValue_typeId` ON `${TABLE_NAME}` (`typeId`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "Measurement",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"measurementId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "MeasurementType",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"typeId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "MeasurementType",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `key` TEXT NOT NULL, `name` TEXT, `color` INTEGER NOT NULL, `icon` TEXT NOT NULL, `unit` TEXT NOT NULL, `inputType` TEXT NOT NULL, `displayOrder` INTEGER NOT NULL, `isDerived` INTEGER NOT NULL, `isEnabled` INTEGER NOT NULL, `isPinned` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "key",
|
||||||
|
"columnName": "key",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "color",
|
||||||
|
"columnName": "color",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "icon",
|
||||||
|
"columnName": "icon",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "unit",
|
||||||
|
"columnName": "unit",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "inputType",
|
||||||
|
"columnName": "inputType",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "displayOrder",
|
||||||
|
"columnName": "displayOrder",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isDerived",
|
||||||
|
"columnName": "isDerived",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isEnabled",
|
||||||
|
"columnName": "isEnabled",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPinned",
|
||||||
|
"columnName": "isPinned",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"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, 'e9e1b3a9fbc321cf52bf869c01f5be21')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -39,8 +39,8 @@ import com.health.openscale.core.utils.LogManager
|
|||||||
MeasurementValue::class,
|
MeasurementValue::class,
|
||||||
MeasurementType::class
|
MeasurementType::class
|
||||||
],
|
],
|
||||||
version = 1, // TODO Increment this on schema changes
|
version = 1,
|
||||||
exportSchema = false // TODO Consider setting to true for production apps to keep schema history
|
exportSchema = true
|
||||||
)
|
)
|
||||||
@TypeConverters(DatabaseConverters::class)
|
@TypeConverters(DatabaseConverters::class)
|
||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
@@ -106,8 +106,6 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
AppDatabase::class.java,
|
AppDatabase::class.java,
|
||||||
DATABASE_NAME
|
DATABASE_NAME
|
||||||
)
|
)
|
||||||
// TODO Destroys and re-creates the database if a migration is needed and not provided. For production, define proper migrations instead.
|
|
||||||
.fallbackToDestructiveMigration()
|
|
||||||
// TODO Add any other configurations like .addCallback(), .setQueryExecutor(), etc. here if needed.
|
// TODO Add any other configurations like .addCallback(), .setQueryExecutor(), etc. here if needed.
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
@@ -22,12 +22,12 @@ default_platform(:android)
|
|||||||
|
|
||||||
platform :android do
|
platform :android do
|
||||||
versionName = get_version_name(
|
versionName = get_version_name(
|
||||||
gradle_file_path:"android_app/app/build.gradle",
|
gradle_file_path:"android_app/app/build.gradle.kts",
|
||||||
ext_constant_name:"versionName"
|
ext_constant_name:"versionName"
|
||||||
)
|
)
|
||||||
|
|
||||||
versionCode = get_version_name(
|
versionCode = get_version_name(
|
||||||
gradle_file_path:"android_app/app/build.gradle",
|
gradle_file_path:"android_app/app/build.gradle.kts",
|
||||||
ext_constant_name:"versionCode"
|
ext_constant_name:"versionCode"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ platform :android do
|
|||||||
project_dir: 'android_app/'
|
project_dir: 'android_app/'
|
||||||
)
|
)
|
||||||
gradle(
|
gradle(
|
||||||
task: "assemble",
|
task: "bundle",
|
||||||
project_dir: 'android_app/',
|
project_dir: 'android_app/',
|
||||||
build_type: "oss"
|
build_type: "oss"
|
||||||
)
|
)
|
||||||
@@ -64,7 +64,7 @@ platform :android do
|
|||||||
project_dir: 'android_app/'
|
project_dir: 'android_app/'
|
||||||
)
|
)
|
||||||
gradle(
|
gradle(
|
||||||
task: "assemble",
|
task: "bundle",
|
||||||
project_dir: 'android_app/',
|
project_dir: 'android_app/',
|
||||||
build_type: "oss"
|
build_type: "oss"
|
||||||
)
|
)
|
||||||
@@ -72,7 +72,7 @@ platform :android do
|
|||||||
package_name: "com.health.openscale.oss",
|
package_name: "com.health.openscale.oss",
|
||||||
track: "production",
|
track: "production",
|
||||||
metadata_path: "fastlane/metadata/android/",
|
metadata_path: "fastlane/metadata/android/",
|
||||||
apk: "android_app/app/build/outputs/apk/oss/openScale-#{versionName}-oss.apk"
|
apk: "android_app/app/build/outputs/bundle/oss/openScale-#{versionName}-oss.apk"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user