Skip to content

Commit

Permalink
- fix room migration
Browse files Browse the repository at this point in the history
  • Loading branch information
salmanA169 committed Dec 28, 2023
1 parent 1b8c051 commit 5d58db9
Show file tree
Hide file tree
Showing 12 changed files with 750 additions and 15 deletions.
13 changes: 13 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions .idea/appInsightsSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/dictionaries/kd.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ android {
applicationId "com.masrofy"
minSdk 28
targetSdk 34
versionCode 12
versionName "4.0.0"
versionCode 13
versionName "4.0.1"

kapt {
arguments {
Expand All @@ -62,6 +62,10 @@ android {
kapt {
correctErrorTypes true
}
sourceSets {
androidTest.assets.srcDirs +=
files("$projectDir/schemas".toString())
}
buildTypes {
release {
minifyEnabled true
Expand Down Expand Up @@ -140,7 +144,7 @@ dependencies {
kapt "androidx.room:room-compiler:$room_version"

testImplementation "androidx.room:room-testing:$room_version"

androidTestImplementation "androidx.room:room-testing:2.6.0"
// hilt
implementation "com.google.dagger:hilt-android:2.48.1"
kapt "com.google.dagger:hilt-compiler:2.48.1"
Expand Down
188 changes: 188 additions & 0 deletions app/schemas/com.masrofy.data.database.MasrofyDatabase/4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"formatVersion": 1,
"database": {
"version": 4,
"identityHash": "e0d31c3ecc6c1bc9ce4d0230edf3a95d",
"entities": [
{
"tableName": "TransactionEntity",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`transactionId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `transactionAccountId` INTEGER NOT NULL, `transactionType` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `amount` INTEGER NOT NULL, `comment` TEXT, `category` TEXT NOT NULL, `currencyCode` TEXT NOT NULL DEFAULT 'USD', `countryCode` TEXT NOT NULL DEFAULT 'US')",
"fields": [
{
"fieldPath": "transactionId",
"columnName": "transactionId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "accountTransactionId",
"columnName": "transactionAccountId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "transactionType",
"columnName": "transactionType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createdAt",
"columnName": "createdAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "amount",
"columnName": "amount",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "comment",
"columnName": "comment",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "category",
"columnName": "category",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "currencyCode",
"columnName": "currencyCode",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'USD'"
},
{
"fieldPath": "countryCode",
"columnName": "countryCode",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'US'"
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"transactionId"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "AccountEntity",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`accountId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `totalAmount` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL, `currency-code` TEXT NOT NULL DEFAULT 'USD', `country-code` TEXT NOT NULL DEFAULT 'US')",
"fields": [
{
"fieldPath": "accountId",
"columnName": "accountId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "totalAmount",
"columnName": "totalAmount",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "createdAt",
"columnName": "createdAt",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "currencyCode",
"columnName": "currency-code",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'USD'"
},
{
"fieldPath": "countryCode",
"columnName": "country-code",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'US'"
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"accountId"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "CategoryEntity",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`category-id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL DEFAULT 0, `nameCategory` TEXT NOT NULL, `type` TEXT NOT NULL, `isPrimary` INTEGER NOT NULL, `position-category` INTEGER NOT NULL DEFAULT 0)",
"fields": [
{
"fieldPath": "idCategory",
"columnName": "category-id",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "nameCategory",
"columnName": "nameCategory",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isPrimary",
"columnName": "isPrimary",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "position",
"columnName": "position-category",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"category-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, 'e0d31c3ecc6c1bc9ce4d0230edf3a95d')"
]
}
}
Loading

0 comments on commit 5d58db9

Please sign in to comment.