feat(07-02): add user session schema, throttle table, and jwt config

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-09-22 13:53:16 +02:00
parent 79e8373560
commit 1311bd6cad
8 changed files with 235 additions and 11 deletions

View File

@@ -38,12 +38,27 @@ func TestCreateOrganisationsMigration(t *testing.T) {
if err := gdb.Raw(`SELECT id FROM summer_migrations_golem15_user ORDER BY id`).Scan(&ids).Error; err != nil {
t.Fatal(err)
}
if len(ids) != 2 || ids[1] != "202609180002_create_organisations" {
want := []string{
"202609170001_create_users",
"202609180002_create_organisations",
"202609220005_extend_users",
"202609220006_create_user_throttle",
"202609220007_create_jwt_blacklist",
}
if len(ids) != len(want) {
t.Fatalf("history = %v", ids)
}
for i := range want {
if ids[i] != want[i] {
t.Fatalf("history = %v", ids)
}
}
if err := m.RollbackLast(); err != nil {
t.Fatal(err)
// jwt blacklist, throttle, extend-users, then organisations.
for range 4 {
if err := m.RollbackLast(); err != nil {
t.Fatal(err)
}
}
if gdb.Migrator().HasTable("golem15_user_organisations") {
t.Fatal("rollback must drop golem15_user_organisations")