[TaskAgile] DB table/column 추가

2021. 1. 6. 15:37개발 관련/TaskAgile

 

 

show index from user;


create table team(
id int(11) not null,
user_id int(11),
archived tinyint(1),
created_date datetime,
primary key(id)
);

alter table team add index fk_user_id_idx (user_id);


create table board(
id int(11) not null,
name varchar(128),
user_id int(11),
team_id int(11),
archived tinyint(1),
created_date datetime,
primary key(id),
foreign key(user_id) references user (id),
foreign key(team_id) references team (id)
);

create table card_list (
id int(11),
board_id int(11),
user_id int(11),
name varchar(255),
position int(11),
archived tinyint(1),
created_date datetime,
primary key(id),
foreign key(user_id) references user (id),
foreign key(board_id) references board (id)
);


create table card (
id int(11) not null,
user_id int(11),
card_id int(11),
file_name varchar(255),
file_path varchar(255),
file_type int(11),
archivee tinyint(1),
created_date datetime,
primary key(id),
foreign key(user_id) references user (id),
foreign key(card_id) references card (id)
);

create table board_member(
board_id int(11),
user_id int(11)
);
alter table board_member add foreign key(board_id) references board (id);
alter table board_member add foreign key(user_id) references user (id);

board_member foreign key 지정하기


create table attachment (
id int(11) not null,
user_id int(11),
card_id int(11),
file_name varchar(255),
file_path varchar(255),
file_type int(11),
archivee tinyint(1),
created_date datetime,
primary key(id),
foreign key(user_id) references user (id),
foreign key(card_id) references card (id)
);

create table activity (
id int(11) not null,
user_id int(11),
card_id int(11),
board_id int(11),
type tinyint(1),
detail json,
created_date datetime,
primary key(id),
foreign key(user_id) references user (id),
foreign key(card_id) references card (id),
foreign key(board_id) references board (id)
);

create table assignment (
card_id int(11),
user_id int(11),
foreign key(user_id) references user (id),
foreign key(card_id) references card (id)
);

 

 

index 조회

 

 

명령어 결과