gin_demo/model/schema.sql
2026-03-27 10:42:46 +08:00

23 lines
787 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- gin_test 数据库 schemasqlite 示例)
-- usersusername 唯一password_hash 存 bcrypt hash
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL UNIQUE,
password_hash TEXT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- 如你后续要做 refresh_token / session可以在下面继续追加建表语句。
-- 例如(示例,不会被当前代码使用):
--
-- CREATE TABLE IF NOT EXISTS refresh_tokens (
-- id INTEGER PRIMARY KEY AUTOINCREMENT,
-- user_id INTEGER NOT NULL,
-- token_hash TEXT NOT NULL UNIQUE,
-- expires_at TIMESTAMP NOT NULL,
-- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
-- );