`qfs -migrate` теперь применяет только migrations/*.sql (встроены в бинарник) с учётом в qt_schema_migrations и завершается, не запуская приложение. Новые команды: make migrate-status (read-only список applied/pending), make migrate, make migrate-baseline UPTO=<file> (пометить как применённые без выполнения). migrate отказывается работать, если в истории нет ни одной применённой миграции — иначе все файлы пошли бы заново. Удалён GORM AutoMigrate против MariaDB (models.Migrate, SeedCategories): устаревший бинарник v1.18 с -migrate прогнал по боевой базе AutoMigrate своих моделей. Миграции идут через отдельное соединение без read/write таймаутов — 3s-таймаут sync-соединения обрывал backfill в 032. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
863 B
Go
33 lines
863 B
Go
package quoteforge
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
)
|
|
|
|
// TemplatesFS contains HTML templates embedded into the binary.
|
|
//
|
|
//go:embed web/templates/*.html web/templates/partials/*.html
|
|
var TemplatesFS embed.FS
|
|
|
|
// StaticFiles contains static assets (CSS, JS, etc.) embedded into the binary.
|
|
//
|
|
//go:embed web/static/*
|
|
var StaticFiles embed.FS
|
|
|
|
// StaticFS returns a filesystem rooted at web/static for serving static assets.
|
|
func StaticFS() (fs.FS, error) {
|
|
return fs.Sub(StaticFiles, "web/static")
|
|
}
|
|
|
|
// MigrationFiles contains the MariaDB server migrations (migrations/*.sql), so
|
|
// `qfs -migrate` works from any directory. Applied via models.RunSQLMigrations.
|
|
//
|
|
//go:embed migrations/*.sql
|
|
var MigrationFiles embed.FS
|
|
|
|
// MigrationsFS returns a filesystem rooted at migrations/.
|
|
func MigrationsFS() (fs.FS, error) {
|
|
return fs.Sub(MigrationFiles, "migrations")
|
|
}
|