File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ CREATE TABLE IF NOT EXISTS posts (
8
8
language VARCHAR (128 ) NOT NULL ,
9
9
content TEXT ,
10
10
source VARCHAR (2048 ),
11
- created_at DATETIME NOT NULL ,
12
- updated_at DATETIME NOT NULL ,
11
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
12
+ updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
13
13
FOREIGN KEY (user_id) REFERENCES users (id)
14
14
);
15
15
-- +migrate Down
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ CREATE TABLE IF NOT EXISTS comments (
9
9
first_line INTEGER ,
10
10
last_line INTEGER ,
11
11
code TEXT ,
12
- created_at DATETIME NOT NULL ,
13
- updated_at DATETIME NOT NULL ,
12
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
13
+ updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
14
14
PRIMARY KEY (id, post_id),
15
15
FOREIGN KEY (post_id) REFERENCES posts (id),
16
16
FOREIGN KEY (user_id) REFERENCES users (id)
You can’t perform that action at this time.
0 commit comments