generated from tsivinsky/go-template
add user authentication
This commit is contained in:
25
db/migrations/20260316171605_init_users.sql
Normal file
25
db/migrations/20260316171605_init_users.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE users (
|
||||
id integer primary key not null,
|
||||
email varchar not null unique,
|
||||
password varchar not null,
|
||||
created_at datetime default current_timestamp,
|
||||
updated_at datetime default current_timestamp
|
||||
);
|
||||
|
||||
CREATE TRIGGER update_users_updated_at
|
||||
AFTER UPDATE ON users
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
UPDATE users
|
||||
SET updated_at = current_timestamp
|
||||
WHERE id = OLD.id;
|
||||
END;
|
||||
-- +goose StatementEnd
|
||||
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
DROP TABLE users;
|
||||
-- +goose StatementEnd
|
||||
|
||||
Reference in New Issue
Block a user