PIbd-33_Mochalov_D.V._Mobile/app/schemas/com.example.shawarma.data.db.AppDatabase/2.json

208 lines
6.0 KiB
JSON

{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "1ce8ad5b9b5decfebb42bc2f3c33393d",
"entities": [
{
"tableName": "users",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `user_login` TEXT NOT NULL, `user_password` TEXT NOT NULL, `user_role` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "login",
"columnName": "user_login",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "password",
"columnName": "user_password",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "role",
"columnName": "user_role",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "orders",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `order_status` TEXT NOT NULL, `user_id` INTEGER, `date` TEXT NOT NULL, FOREIGN KEY(`user_id`) REFERENCES `users`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "status",
"columnName": "order_status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "userId",
"columnName": "user_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_orders_user_id",
"unique": false,
"columnNames": [
"user_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_orders_user_id` ON `${TABLE_NAME}` (`user_id`)"
}
],
"foreignKeys": [
{
"table": "users",
"onDelete": "NO ACTION",
"onUpdate": "NO ACTION",
"columns": [
"user_id"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "products",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `product_title` TEXT NOT NULL, `product_price` INTEGER NOT NULL, `product_old_price` INTEGER)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "title",
"columnName": "product_title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "price",
"columnName": "product_price",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "oldPrice",
"columnName": "product_old_price",
"affinity": "INTEGER",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "order_product",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`order_id` INTEGER NOT NULL, `product_id` INTEGER NOT NULL, `quantity` INTEGER NOT NULL, `total_price` INTEGER NOT NULL, PRIMARY KEY(`order_id`, `product_id`))",
"fields": [
{
"fieldPath": "orderId",
"columnName": "order_id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "productId",
"columnName": "product_id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "quantity",
"columnName": "quantity",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "totalPrice",
"columnName": "total_price",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"order_id",
"product_id"
]
},
"indices": [
{
"name": "index_order_product_order_id",
"unique": false,
"columnNames": [
"order_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_order_product_order_id` ON `${TABLE_NAME}` (`order_id`)"
},
{
"name": "index_order_product_product_id",
"unique": false,
"columnNames": [
"product_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_order_product_product_id` ON `${TABLE_NAME}` (`product_id`)"
}
],
"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, '1ce8ad5b9b5decfebb42bc2f3c33393d')"
]
}
}