Skip to content

Commit 08d9006

Browse files
committed
feat: set default values for created_at and updated_at in schema
1 parent 05a9d20 commit 08d9006

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/main/resources/schema.sql

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
create table meme
33
(
44
id bigint auto_increment primary key,
5-
created_at timestamp(6),
6-
updated_at timestamp(6),
5+
created_at timestamp(6) default current_timestamp,
6+
updated_at timestamp(6) default current_timestamp,
77
title varchar(255) not null comment '밈 제목',
88
origin text null comment '밈의 유래',
99
usage_context text null comment '밈 사용 맥락(언제 사용하는지 상황 맥락)',
10-
trend_period varchar(10) comment '밈 유행 기간',
10+
trend_period varchar(10) comment '밈 유행 기간 (YYYY)',
1111
img_url varchar(255) null comment '이미지 url',
1212
hashtags text null comment '해시태그 (json 형태로 저장)',
1313
);
@@ -16,35 +16,35 @@ create table meme
1616
create table meme_view_log
1717
(
1818
id bigint auto_increment primary key,
19-
created_at timestamp(6),
20-
updated_at timestamp(6),
19+
created_at timestamp(6) default current_timestamp,
20+
updated_at timestamp(6) default current_timestamp,
2121
meme_id bigint not null,
2222
);
2323

2424
-- 밈 커스텀(나만의 밈 만들기) 로그 테이블
2525
create table meme_custom_log
2626
(
2727
id bigint auto_increment primary key,
28-
created_at timestamp(6),
29-
updated_at timestamp(6),
28+
created_at timestamp(6) default current_timestamp,
29+
updated_at timestamp(6) default current_timestamp,
3030
meme_id bigint not null,
3131
);
3232

3333
-- 밈 공유 로그 테이블
3434
create table meme_share_log
3535
(
3636
id bigint auto_increment primary key,
37-
created_at timestamp(6),
38-
updated_at timestamp(6),
37+
created_at timestamp(6) default current_timestamp,
38+
updated_at timestamp(6) default current_timestamp,
3939
meme_id bigint not null,
4040
);
4141

4242
-- 카테고리
4343
create table category
4444
(
4545
id bigint auto_increment primary key,
46-
created_at timestamp(6),
47-
updated_at timestamp(6),
46+
created_at timestamp(6) default current_timestamp,
47+
updated_at timestamp(6) default current_timestamp,
4848
name varchar(255) not null comment '카테고리 이름',
4949
img_url varchar(255) not null comment '카테고리 대표 이미지 URL',
5050

@@ -55,8 +55,8 @@ create table category
5555
create table meme_category
5656
(
5757
id bigint auto_increment primary key,
58-
created_at timestamp(6),
59-
updated_at timestamp(6),
58+
created_at timestamp(6) default current_timestamp,
59+
updated_at timestamp(6) default current_timestamp,
6060
meme_id bigint not null,
6161
category_id bigint not null,
6262
)

0 commit comments

Comments
 (0)