feat(backend): add transactional outbox and embedded goose migrations

This commit is contained in:
shira committed 2026-10-05 23:32:43 +03:00
1 parent 653f3775f8
commit 15e2e50561
40 files changed
+2471 -67

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
// Package db embeds the versioned SQL migrations so the backend binary applies
// exactly the schema it was built with. The SQL files stay in db/migrations,
// where sqlc and sqlfluff also read them; go:embed cannot reach a parent
// directory, so the embedding package lives next to that directory.
package db
import (
"embed"
"fmt"
"io/fs"
)
const migrationsDirectory = "migrations"
//go:embed migrations/*.sql
var migrationFiles embed.FS
// Migrations returns the goose SQL migrations with file names at the root.
func Migrations() (fs.FS, error) {
migrations, err := fs.Sub(migrationFiles, migrationsDirectory)
if err != nil {
return nil, fmt.Errorf("db.Migrations - open embedded migrations: %w", err)
}
return migrations, nil
}