FastAPI Mysql Create Database Tables - 61

2023. 1. 15. 22:54·Develop/FastAPI
728x90
SMALL

 

1. 스키마 생성

 

2. 테이블 생성

use todoapp;

DROP TABLE IF EXISTS `users`;

CREATE TABLE `users`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(200) DEFAULT NULL,
`username` varchar(45) DEFAULT NULL,
`first_name` varchar(45) DEFAULT NULL,
`last_name` varchar(45) DEFAULT NULL,
`hashed_password` varchar(200) DEFAULT NULL,
`is_active` int(1) DEFAULT NULL,
PRIMARY KEY(`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `todos`;

CREATE TABLE `todos`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(200) DEFAULT NULL,
`description` varchar(200) DEFAULT NULL,
`priority` int(1) DEFAULT NULL,

`complete` int(1) DEFAULT NULL,
`owner_id` int(11) DEFAULT NULL,
PRIMARY KEY(`id`),
FOREIGN KEY(`owner_id`) REFERENCES users(`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

 

3. 테이블 생성 확인

728x90
SMALL
저작자표시 비영리 변경금지 (새창열림)

'Develop > FastAPI' 카테고리의 다른 글

FastAPI Create Data for MySQL - 63  (0) 2023.01.15
FastAPI Connect FastAPI to MySQL - 62  (0) 2023.01.15
FastAPI Create Data for PostgreSQL - 60  (0) 2023.01.15
FastAPI PostgreSQL Connect to FastAPI - 59  (0) 2023.01.15
FastAPI PostgreSQL Create Database Table - 58  (0) 2023.01.15
'Develop/FastAPI' 카테고리의 다른 글
  • FastAPI Create Data for MySQL - 63
  • FastAPI Connect FastAPI to MySQL - 62
  • FastAPI Create Data for PostgreSQL - 60
  • FastAPI PostgreSQL Connect to FastAPI - 59
동석해요
동석해요
공부하고 싶은게 많은, 사소한 IT 지식들 공유
    250x250
  • 동석해요
    개발로 자기계발
    동석해요
  • 전체
    오늘
    어제
    • 분류 전체보기 (226)
      • Develop (126)
        • 기초지식 (12)
        • FastAPI (102)
        • Django (11)
      • Database & Data (62)
        • 기초지식 (16)
        • MySQL (29)
        • PostgreSQL (8)
        • 데이터 분석 (9)
      • 인공지능 (11)
        • PyTorch (9)
      • Cloud (8)
        • AWS (4)
        • GCP (2)
      • 버그처리 (14)
      • 회고 & 일상 (5)
  • 인기 글

  • 최근 글

  • 최근 댓글

  • hELLO· Designed By정상우.v4.10.3
동석해요
FastAPI Mysql Create Database Tables - 61
상단으로

티스토리툴바