my laundry project database schemas

haru·2023년 1월 19일
0
create database laundry;
use laundry;
create table User (
	id int not null auto_increment,
	userId varchar(255) not null,
    usertype int  not null,
    nickname varchar(255) not null,
    password varchar(255) not null,
    email varchar(255) not null,
    phone varchar(255) not null,
    point int unsigned default 1000000,
    createdAt datetime not null default now(),
    updatedAt datetime not null default now() on update now(),
    primary key(id),
    unique index nickname_UNIQUE (nickname ASC),   
    unique index userId_UNIQUE (nickname ASC),
    unique index email_UNIQUE (email ASC),
    unique index phone_UNIQUE (phone ASC))
    comment = '사용자 정보'
    default character set = utf8mb4
    engine = InnoDB;
    create table Orders (
	id int not null auto_increment,
    status int not null,
	adress varchar(255) not null,
    image_path varchar(255) not null,
    deliver int not null,
    receiver int not null,
    review int not null,
    createdAt datetime not null default now(),
    updatedAt datetime not null default now() on update now(),
    primary key(id),
	index deliver_idx (deliver ASC),
    constraint deliver foreign key (deliver) references User (id) on delete cascade on update cascade,
    index receiver_idx (receiver ASC),
    constraint receiver foreign key (receiver) references User(id) on delete cascade on update cascade
    )
    comment = '세탁물 신청 정보'
    default character set = utf8mb4
    engine = InnoDB;


    
    create table Review (
	id int not null auto_increment,
    score int not null,
    content varchar(255) not null,
    image_path varchar(255) not null,
    reviewer int not null,
    reviewOrder int not null,
    createdAt datetime not null default now(),
    updatedAt datetime not null default now() on update now(),
    primary key(id),
	index reviewer_idx (reviewer ASC),
    constraint reviewer foreign key (reviewer) references User (id) on delete cascade on update cascade,
    index reviewOrder_idx (reviewOrder ASC),
    constraint reviewOrder foreign key (reviewOrder) references Orders (id) on delete cascade on update cascade
    )
    comment = '리뷰 정보'
    default character set = utf8mb4
    engine = InnoDB;
    
    

0개의 댓글