This commit is contained in:
blankhex committed 2026-10-21 19:41:26 +03:00
commit 97dc0a3570
78 files changed
+7054

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
package auth
import "goAuth/internal/migration"
func Migrations() []migration.Migration {
return []migration.Migration{
{
Version: 1,
SQL: `CREATE TABLE IF NOT EXISTS sessions (
token TEXT PRIMARY KEY,
user_id INTEGER NOT NULL,
address TEXT,
device TEXT,
created_at DATETIME NOT NULL,
expires_at DATETIME NOT NULL,
is_long INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);`,
},
{
Version: 2,
SQL: "CREATE INDEX IF NOT EXISTS idx_sessions_user_id ON sessions(user_id);",
},
}
}