Skip to content

Commit b1733d3

Browse files
authored
Merge pull request #42 from igh9410/dev
fixed some error logging format
2 parents 6419d94 + 00e495d commit b1733d3

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- +goose Up
2+
-- +goose StatementBegin
3+
CREATE TABLE notifications (
4+
id SERIAL PRIMARY KEY,
5+
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
6+
message TEXT NOT NULL,
7+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
8+
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
9+
);
10+
CREATE INDEX idx_notifications_user_id ON notifications(user_id);
11+
CREATE INDEX idx_notifications_created_at ON notifications(created_at);
12+
13+
-- +goose StatementEnd
14+
15+
-- +goose Down
16+
-- +goose StatementBegin
17+
DROP INDEX IF EXISTS idx_notifications_user_id;
18+
DROP INDEX IF EXISTS idx_notifications_created_at;
19+
DROP TABLE notifications;
20+
-- +goose StatementEnd

backend/db/migrations/migrations.txt

-4
This file was deleted.

backend/internal/user/repository.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ func (r *repository) CreateUser(ctx context.Context, user *User) (*User, error)
5353
err = r.db.QueryRowContext(ctx, query, user.ID, user.Username, user.Email, user.ProfileImageURL, user.CreatedAt).Scan(&user.ID)
5454

5555
if err != nil {
56-
log.Printf("Error creating user, db execcontext: %d", err)
56+
log.Printf("Error creating user, db execcontext: %v", err)
5757
return nil, err
5858
}
5959

6060
// Commit transaction
6161
if err = tx.Commit(); err != nil {
62-
log.Printf("Transaction commit failed: %d", err)
62+
log.Printf("Transaction commit failed: %v", err)
6363
return nil, err
6464
}
6565

0 commit comments

Comments
 (0)