更新数据库结构

This commit is contained in:
ShouChenICU 2022-04-15 18:26:55 +08:00
parent e46aba2e4c
commit 724d0a983b

View File

@ -3,14 +3,14 @@
Source Server : InventoryProMax
Source Server Type : SQLite
Source Server Version : 3030001
Source Server Version : 3035005
Source Schema : main
Target Server Type : SQLite
Target Server Version : 3030001
Target Server Version : 3035005
File Encoding : 65001
Date: 24/03/2022 15:42:10
Date: 15/04/2022 18:21:34
*/
PRAGMA foreign_keys = false;
@ -47,7 +47,9 @@ CREATE TABLE "r_inv_product" (
"inv_id" integer NOT NULL,
"pro_id" integer NOT NULL,
"quantity" integer NOT NULL DEFAULT 0,
PRIMARY KEY ("inv_id", "pro_id")
PRIMARY KEY ("inv_id", "pro_id"),
CONSTRAINT "inv_id" FOREIGN KEY ("inv_id") REFERENCES "t_inventories" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "pro_id" FOREIGN KEY ("pro_id") REFERENCES "t_products" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- ----------------------------
@ -73,18 +75,6 @@ CREATE TABLE "r_user_avatar" (
CONSTRAINT "file_id" FOREIGN KEY ("file_id") REFERENCES "t_files" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- ----------------------------
-- Table structure for sqlite_sequence
-- ----------------------------
DROP TABLE IF EXISTS "sqlite_sequence";
CREATE TABLE sqlite_sequence(name,seq);
-- ----------------------------
-- Table structure for sqlite_stat1
-- ----------------------------
DROP TABLE IF EXISTS "sqlite_stat1";
CREATE TABLE sqlite_stat1(tbl,idx,stat);
-- ----------------------------
-- Table structure for t_categories
-- ----------------------------
@ -128,7 +118,7 @@ DROP TABLE IF EXISTS "t_order_items";
CREATE TABLE "t_order_items" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"ord_id" integer NOT NULL,
"pro_id" integer NOT NULL,
"pro_id" integer,
"inv_id" integer NOT NULL,
"title" text NOT NULL,
"model" text NOT NULL DEFAULT '',
@ -140,7 +130,8 @@ CREATE TABLE "t_order_items" (
"remarks" text NOT NULL DEFAULT '',
"create_time" text NOT NULL DEFAULT '',
CONSTRAINT "ord_id" FOREIGN KEY ("ord_id") REFERENCES "t_orders" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "inv_id" FOREIGN KEY ("inv_id") REFERENCES "t_inventories" ("id") ON DELETE NO ACTION ON UPDATE CASCADE
CONSTRAINT "inv_id" FOREIGN KEY ("inv_id") REFERENCES "t_inventories" ("id") ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT "pro_id" FOREIGN KEY ("pro_id") REFERENCES "t_products" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- ----------------------------
@ -180,7 +171,8 @@ CREATE TABLE "t_products" (
"status" integer NOT NULL DEFAULT 0,
"weight" real NOT NULL DEFAULT 0.00,
"description" text NOT NULL DEFAULT '',
"create_time" text NOT NULL DEFAULT ''
"create_time" text NOT NULL DEFAULT '',
CONSTRAINT "cate_id" FOREIGN KEY ("cate_id") REFERENCES "t_categories" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- ----------------------------
@ -190,7 +182,7 @@ DROP TABLE IF EXISTS "t_restock_items";
CREATE TABLE "t_restock_items" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"res_id" integer NOT NULL,
"pro_id" integer NOT NULL,
"pro_id" integer,
"inv_id" integer NOT NULL,
"title" text NOT NULL,
"model" text NOT NULL DEFAULT '',
@ -201,7 +193,8 @@ CREATE TABLE "t_restock_items" (
"remarks" text NOT NULL DEFAULT '',
"create_time" text NOT NULL DEFAULT '',
CONSTRAINT "res_id" FOREIGN KEY ("res_id") REFERENCES "t_restocks" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "inv_id" FOREIGN KEY ("inv_id") REFERENCES "t_inventories" ("id") ON DELETE NO ACTION ON UPDATE CASCADE
CONSTRAINT "inv_id" FOREIGN KEY ("inv_id") REFERENCES "t_inventories" ("id") ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT "pro_id" FOREIGN KEY ("pro_id") REFERENCES "t_products" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
-- ----------------------------