{ "version": "6", "dialect": "sqlite", "id": "4ebc4f18-552b-459a-abef-dc2dfe600cd2", "prevId": "dfa18399-c3f0-4ef0-896b-632b38f67c1f", "tables": { "storage_spaces": { "name": "storage_spaces", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "description": { "name": "description", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "aliases": { "name": "aliases", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'[]'" }, "image_urls": { "name": "image_urls", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'[]'" }, "enterprise_id": { "name": "enterprise_id", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "storage_spaces_enterprise_idx": { "name": "storage_spaces_enterprise_idx", "columns": [ "enterprise_id" ], "isUnique": false } }, "foreignKeys": { "storage_spaces_enterprise_id_enterprises_id_fk": { "name": "storage_spaces_enterprise_id_enterprises_id_fk", "tableFrom": "storage_spaces", "tableTo": "enterprises", "columnsFrom": [ "enterprise_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "distributors": { "name": "distributors", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "agency": { "name": "agency", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "contact": { "name": "contact", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "mobile": { "name": "mobile", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "address": { "name": "address", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "enterprise_id": { "name": "enterprise_id", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "distributors_enterprise_idx": { "name": "distributors_enterprise_idx", "columns": [ "enterprise_id" ], "isUnique": false } }, "foreignKeys": { "distributors_enterprise_id_enterprises_id_fk": { "name": "distributors_enterprise_id_enterprises_id_fk", "tableFrom": "distributors", "tableTo": "enterprises", "columnsFrom": [ "enterprise_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "products": { "name": "products", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "brand": { "name": "brand", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "category": { "name": "category", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "distributor_id": { "name": "distributor_id", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "unit_id": { "name": "unit_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "procured_price": { "name": "procured_price", "type": "real", "primaryKey": false, "notNull": true, "autoincrement": false }, "mrp": { "name": "mrp", "type": "real", "primaryKey": false, "notNull": true, "autoincrement": false }, "selling_price": { "name": "selling_price", "type": "real", "primaryKey": false, "notNull": true, "autoincrement": false }, "size": { "name": "size", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "reorder_level": { "name": "reorder_level", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "units_per_strip": { "name": "units_per_strip", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "hide_product_from_public": { "name": "hide_product_from_public", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "hide_price_from_public": { "name": "hide_price_from_public", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "enterprise_id": { "name": "enterprise_id", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "products_enterprise_idx": { "name": "products_enterprise_idx", "columns": [ "enterprise_id" ], "isUnique": false } }, "foreignKeys": { "products_distributor_id_distributors_id_fk": { "name": "products_distributor_id_distributors_id_fk", "tableFrom": "products", "tableTo": "distributors", "columnsFrom": [ "distributor_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "products_unit_id_units_id_fk": { "name": "products_unit_id_units_id_fk", "tableFrom": "products", "tableTo": "units", "columnsFrom": [ "unit_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "products_enterprise_id_enterprises_id_fk": { "name": "products_enterprise_id_enterprises_id_fk", "tableFrom": "products", "tableTo": "enterprises", "columnsFrom": [ "enterprise_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "drug_info": { "name": "drug_info", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "drug_info_name_unique": { "name": "drug_info_name_unique", "columns": [ "name" ], "isUnique": true } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "units": { "name": "units", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "units_name_unique": { "name": "units_name_unique", "columns": [ "name" ], "isUnique": true } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "product_compositions": { "name": "product_compositions", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "product_id": { "name": "product_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "drug_info_id": { "name": "drug_info_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "quantity": { "name": "quantity", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "unit_id": { "name": "unit_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "product_compositions_product_id_products_id_fk": { "name": "product_compositions_product_id_products_id_fk", "tableFrom": "product_compositions", "tableTo": "products", "columnsFrom": [ "product_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "product_compositions_drug_info_id_drug_info_id_fk": { "name": "product_compositions_drug_info_id_drug_info_id_fk", "tableFrom": "product_compositions", "tableTo": "drug_info", "columnsFrom": [ "drug_info_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "product_compositions_unit_id_units_id_fk": { "name": "product_compositions_unit_id_units_id_fk", "tableFrom": "product_compositions", "tableTo": "units", "columnsFrom": [ "unit_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "stock_batches": { "name": "stock_batches", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "product_id": { "name": "product_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "arrived": { "name": "arrived", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "batch_no": { "name": "batch_no", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "mfg": { "name": "mfg", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "expiry": { "name": "expiry", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "rack_id": { "name": "rack_id", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "distributor_id": { "name": "distributor_id", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "quantity": { "name": "quantity", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "is_default": { "name": "is_default", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "enterprise_id": { "name": "enterprise_id", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "stock_batches_enterprise_idx": { "name": "stock_batches_enterprise_idx", "columns": [ "enterprise_id" ], "isUnique": false } }, "foreignKeys": { "stock_batches_product_id_products_id_fk": { "name": "stock_batches_product_id_products_id_fk", "tableFrom": "stock_batches", "tableTo": "products", "columnsFrom": [ "product_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "stock_batches_rack_id_storage_spaces_id_fk": { "name": "stock_batches_rack_id_storage_spaces_id_fk", "tableFrom": "stock_batches", "tableTo": "storage_spaces", "columnsFrom": [ "rack_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "stock_batches_distributor_id_distributors_id_fk": { "name": "stock_batches_distributor_id_distributors_id_fk", "tableFrom": "stock_batches", "tableTo": "distributors", "columnsFrom": [ "distributor_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "stock_batches_enterprise_id_enterprises_id_fk": { "name": "stock_batches_enterprise_id_enterprises_id_fk", "tableFrom": "stock_batches", "tableTo": "enterprises", "columnsFrom": [ "enterprise_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "enterprises": { "name": "enterprises", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "type": { "name": "type", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "owner_name": { "name": "owner_name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "mobile": { "name": "mobile", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "address": { "name": "address", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "staff": { "name": "staff", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "username": { "name": "username", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "mobile": { "name": "mobile", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "added_on": { "name": "added_on", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "password": { "name": "password", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "is_password_reset_needed": { "name": "is_password_reset_needed", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": true } }, "indexes": { "staff_username_unique": { "name": "staff_username_unique", "columns": [ "username" ], "isUnique": true } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "roles": { "name": "roles", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "roles_name_unique": { "name": "roles_name_unique", "columns": [ "name" ], "isUnique": true } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "permissions": { "name": "permissions", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "permissions_name_unique": { "name": "permissions_name_unique", "columns": [ "name" ], "isUnique": true } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "role_permissions": { "name": "role_permissions", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "role_id": { "name": "role_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "permission_id": { "name": "permission_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "role_permissions_role_id_roles_id_fk": { "name": "role_permissions_role_id_roles_id_fk", "tableFrom": "role_permissions", "tableTo": "roles", "columnsFrom": [ "role_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "role_permissions_permission_id_permissions_id_fk": { "name": "role_permissions_permission_id_permissions_id_fk", "tableFrom": "role_permissions", "tableTo": "permissions", "columnsFrom": [ "permission_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "staff_roles": { "name": "staff_roles", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "staff_id": { "name": "staff_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "role_id": { "name": "role_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "staff_roles_staff_id_staff_id_fk": { "name": "staff_roles_staff_id_staff_id_fk", "tableFrom": "staff_roles", "tableTo": "staff", "columnsFrom": [ "staff_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "staff_roles_role_id_roles_id_fk": { "name": "staff_roles_role_id_roles_id_fk", "tableFrom": "staff_roles", "tableTo": "roles", "columnsFrom": [ "role_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "enterprise_staff": { "name": "enterprise_staff", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "staff_id": { "name": "staff_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "enterprise_id": { "name": "enterprise_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "enterprise_staff_staff_id_staff_id_fk": { "name": "enterprise_staff_staff_id_staff_id_fk", "tableFrom": "enterprise_staff", "tableTo": "staff", "columnsFrom": [ "staff_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "enterprise_staff_enterprise_id_enterprises_id_fk": { "name": "enterprise_staff_enterprise_id_enterprises_id_fk", "tableFrom": "enterprise_staff", "tableTo": "enterprises", "columnsFrom": [ "enterprise_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} } }, "views": {}, "enums": {}, "_meta": { "schemas": {}, "tables": {}, "columns": {} }, "internal": { "indexes": {} } }