Add generated json database schema

This commit is contained in:
jacques 2022-03-08 19:46:20 +01:00
parent be85f8c69d
commit c43e5d1880
2 changed files with 99 additions and 8 deletions

View file

@ -39,6 +39,11 @@ android {
versionCode 100 versionCode 100
versionName "v0.100-beta" versionName "v0.100-beta"
multiDexEnabled true multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
} }
buildTypes { buildTypes {
@ -102,9 +107,12 @@ sourceSets {
} }
} }
dependencies { dependencies {
implementation 'androidx.room:room-common:2.4.2' implementation "androidx.room:room-common:2.4.2"
annotationProcessor 'androidx.room:room-compiler:2.4.2' annotationProcessor "androidx.room:room-compiler:2.4.2"
def room_version = "2.4.2" implementation "androidx.room:room-testing:2.4.2"
implementation "androidx.room:room-rxjava3:2.4.2"
implementation "androidx.room:room-runtime:2.4.2"
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
@ -112,13 +120,8 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx:room:room-runtime:$room_version"
implementation 'com.journeyapps:zxing-android-embedded:4.3.0' implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
implementation 'androidx.core:core:1.7.0' implementation 'androidx.core:core:1.7.0'
implementation "androidx:room:room-runtime:$room_version"
implementation "androidx.room:room-rxjava3:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
} }

View file

@ -0,0 +1,88 @@
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "5ac4c79044120e5fa2716c6a89eff9bf",
"entities": [
{
"tableName": "medics",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cis` TEXT NOT NULL, `cip13` TEXT, `name` TEXT, `administration_mode` TEXT, `presentation` TEXT, `stock` INTEGER, `take` INTEGER, `warning` INTEGER, `alert` INTEGER, `last_update` INTEGER, PRIMARY KEY(`cis`))",
"fields": [
{
"fieldPath": "cis",
"columnName": "cis",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "cip13",
"columnName": "cip13",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "administration_mode",
"columnName": "administration_mode",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "presentation",
"columnName": "presentation",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "stock",
"columnName": "stock",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "take",
"columnName": "take",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "warning",
"columnName": "warning",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "alert",
"columnName": "alert",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "last_update",
"columnName": "last_update",
"affinity": "INTEGER",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"cis"
],
"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, '5ac4c79044120e5fa2716c6a89eff9bf')"
]
}
}