3bd237d562
Фаза 2, Task 1: добавлена таблица sessions и nullable password_hash у users, sqlc-запросы и *Store-обёртки (CreateUser, GetUserByEmail, CreateProjectForUser, GetProjectOwned, GetUserProject, CreateSession, GetSessionUser, DeleteSession, RegisterUser в транзакции), интеграционные тесты на testcontainers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BwxdSt4reTm7Dj1oxRvpP3
16 lines
461 B
SQL
16 lines
461 B
SQL
-- +goose Up
|
|
ALTER TABLE users ADD COLUMN password_hash text;
|
|
|
|
CREATE TABLE sessions (
|
|
id uuid PRIMARY KEY,
|
|
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
token_hash text NOT NULL UNIQUE,
|
|
expires_at timestamptz NOT NULL,
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
CREATE INDEX sessions_token_hash_idx ON sessions (token_hash);
|
|
|
|
-- +goose Down
|
|
DROP TABLE sessions;
|
|
ALTER TABLE users DROP COLUMN password_hash;
|