You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
4.6 KiB
SQL
118 lines
4.6 KiB
SQL
/*==============================================================*/
|
|
/* DBMS name: MySQL 5.0 */
|
|
/* Created on: 2023/6/7 17:15:59 */
|
|
/*==============================================================*/
|
|
|
|
|
|
drop table if exists ps_company;
|
|
|
|
drop table if exists ps_orders;
|
|
|
|
drop table if exists ps_photo;
|
|
|
|
drop table if exists ps_product;
|
|
|
|
drop table if exists ps_worker;
|
|
|
|
/*==============================================================*/
|
|
/* Table: ps_company */
|
|
/*==============================================================*/
|
|
create table ps_company
|
|
(
|
|
com_id bigint not null comment '影楼编号',
|
|
user_id bigint,
|
|
com_name varchar(128) comment '影楼名称',
|
|
com_address varchar(256) comment '影楼地点',
|
|
com_tel varchar(64) comment '影楼联系电话',
|
|
com_desc varchar(2000) comment '影楼简介',
|
|
com_json varchar(2000) comment '影楼JSON',
|
|
com_score int comment '影楼评分',
|
|
primary key (com_id)
|
|
);
|
|
|
|
alter table ps_company comment '影楼';
|
|
|
|
/*==============================================================*/
|
|
/* Table: ps_orders */
|
|
/*==============================================================*/
|
|
create table ps_orders
|
|
(
|
|
order_id bigint not null comment '编号',
|
|
user_id bigint,
|
|
ps__user_id bigint,
|
|
product_id bigint comment '摄影套餐编号',
|
|
order_price int comment '实际价格',
|
|
order_create_time datetime comment '创建时间',
|
|
order_sub_time datetime comment '预约时间',
|
|
order_exec_time datetime comment '执行时间',
|
|
order_desc varchar(256) comment '客户说明',
|
|
order_status int comment '订单状态',
|
|
primary key (order_id)
|
|
);
|
|
|
|
alter table ps_orders comment '摄影订单';
|
|
|
|
/*==============================================================*/
|
|
/* Table: ps_photo */
|
|
/*==============================================================*/
|
|
create table ps_photo
|
|
(
|
|
photo_id bigint not null comment '编号',
|
|
order_id bigint comment '编号',
|
|
photo_src bigint comment '原图编号',
|
|
photo_big bigint comment '大图编号',
|
|
photo_small bigint comment '小图编号',
|
|
photo_selected bool comment '已选',
|
|
photo_time datetime comment '上传时间',
|
|
primary key (photo_id)
|
|
);
|
|
|
|
alter table ps_photo comment '照片信息';
|
|
|
|
/*==============================================================*/
|
|
/* Table: ps_product */
|
|
/*==============================================================*/
|
|
create table ps_product
|
|
(
|
|
product_id bigint not null comment '摄影套餐编号',
|
|
com_id bigint comment '影楼编号',
|
|
product_name varchar(128) comment '摄影套餐名称',
|
|
product_photo_num int comment '摄影套餐照片数量',
|
|
product_clothing_num int comment '摄影套餐服装套数',
|
|
product_scene_num int comment '摄影套餐场景数',
|
|
product_price int comment '摄影套餐价格',
|
|
product_desc varchar(2000) comment '摄影套餐简介',
|
|
product_time datetime comment '摄影套餐创建时间',
|
|
product_putaway bool comment '摄影套餐是否上架',
|
|
primary key (product_id)
|
|
);
|
|
|
|
alter table ps_product comment '摄影套餐';
|
|
|
|
/*==============================================================*/
|
|
/* Table: ps_worker */
|
|
/*==============================================================*/
|
|
create table ps_worker
|
|
(
|
|
user_id bigint not null,
|
|
com_id bigint comment '影楼编号',
|
|
worker_json varchar(2000) comment '摄影师JSON',
|
|
worker_desc varchar(2000) comment '摄影师简介',
|
|
primary key (user_id)
|
|
);
|
|
|
|
alter table ps_worker comment '摄影师';
|
|
|
|
alter table ps_orders add constraint fk_r_6 foreign key (product_id)
|
|
references ps_product (product_id) on delete restrict on update restrict;
|
|
|
|
alter table ps_photo add constraint fk_r_9 foreign key (order_id)
|
|
references ps_orders (order_id) on delete restrict on update restrict;
|
|
|
|
alter table ps_product add constraint fk_r_5 foreign key (com_id)
|
|
references ps_company (com_id) on delete restrict on update restrict;
|
|
|
|
alter table ps_worker add constraint fk_r_2 foreign key (com_id)
|
|
references ps_company (com_id) on delete restrict on update restrict;
|
|
|