Change Medicine schema

This commit is contained in:
jacques 2022-03-17 18:23:10 +01:00
parent 5572cdcf67
commit 303f849f50
3 changed files with 23 additions and 8 deletions

View file

@ -2,17 +2,23 @@
"formatVersion": 1, "formatVersion": 1,
"database": { "database": {
"version": 1, "version": 1,
"identityHash": "71fee21ecfa4bc2a534eca55c0f0cd49", "identityHash": "96dc5c4ccb337047e323d613eb86bdd1",
"entities": [ "entities": [
{ {
"tableName": "medicines", "tableName": "drugs",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cis` TEXT NOT NULL, `cip13` TEXT, `cip7` TEXT, `administration_mode` TEXT, `name` TEXT, `presentation` TEXT, `label_group` TEXT, `generic_type` INTEGER, PRIMARY KEY(`cis`))", "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER NOT NULL, `cis` TEXT, `cip13` TEXT, `cip7` TEXT, `administration_mode` TEXT, `name` TEXT, `presentation` TEXT, `label_group` TEXT, `generic_type` INTEGER, PRIMARY KEY(`_id`))",
"fields": [ "fields": [
{
"fieldPath": "_id",
"columnName": "_id",
"affinity": "INTEGER",
"notNull": true
},
{ {
"fieldPath": "cis", "fieldPath": "cis",
"columnName": "cis", "columnName": "cis",
"affinity": "TEXT", "affinity": "TEXT",
"notNull": true "notNull": false
}, },
{ {
"fieldPath": "cip13", "fieldPath": "cip13",
@ -59,7 +65,7 @@
], ],
"primaryKey": { "primaryKey": {
"columnNames": [ "columnNames": [
"cis" "_id"
], ],
"autoGenerate": false "autoGenerate": false
}, },
@ -70,7 +76,7 @@
"views": [], "views": [],
"setupQueries": [ "setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "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, '71fee21ecfa4bc2a534eca55c0f0cd49')" "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '96dc5c4ccb337047e323d613eb86bdd1')"
] ]
} }
} }

Binary file not shown.

View file

@ -4,10 +4,10 @@ import androidx.annotation.NonNull;
import androidx.room.Entity; import androidx.room.Entity;
import androidx.room.PrimaryKey; import androidx.room.PrimaryKey;
@Entity(tableName = "medicines") @Entity(tableName = "drugs")
public class Medicine { public class Medicine {
@PrimaryKey @PrimaryKey
@NonNull @NonNull private Integer _id;
private String cis; private String cis;
private String cip13; private String cip13;
private String cip7; private String cip7;
@ -85,4 +85,13 @@ public class Medicine {
public void setGeneric_type(Integer generic_type) { public void setGeneric_type(Integer generic_type) {
this.generic_type = generic_type; this.generic_type = generic_type;
} }
@NonNull
public Integer get_id() {
return _id;
}
public void set_id(@NonNull Integer _id) {
this._id = _id;
}
} }