feat(17-04): faq:import-winter and the read-only Winter export SQL

- JSON lines import keeping ids, locale_id looked up by locale code (an unknown code aborts before any write)
- one transaction, setval past the copied ids, --force replaces, --dry-run reports, an empty file copies nothing
- scripts/winter-export.sql: SELECT JSON_OBJECT with the translate locale code
- TestFaqImportSmoke
This commit is contained in:
2026-10-12 17:35:30 +02:00
parent 1c5491232a
commit 7413c6905d
5 changed files with 575 additions and 0 deletions

View File

@@ -4,9 +4,11 @@
package faq
import (
"git.golem15.com/golem15/sm-faq-plugin/console"
"git.golem15.com/golem15/sm-faq-plugin/models"
"git.golem15.com/golem15/sm-faq-plugin/updates"
"git.golem15.com/golem15/summercms/modules/backpack"
"git.golem15.com/golem15/summercms/modules/bonfire"
"git.golem15.com/golem15/summercms/modules/pact"
"git.golem15.com/golem15/summercms/modules/party"
"github.com/go-gormigrate/gormigrate/v2"
@@ -16,6 +18,7 @@ var (
_ party.Plugin = (*Plugin)(nil)
_ pact.HasMigrations = (*Plugin)(nil)
_ pact.HasModels = (*Plugin)(nil)
_ pact.HasCommands = (*Plugin)(nil)
)
// Plugin is the golem15.faq plugin.
@@ -38,6 +41,11 @@ func (p *Plugin) Boot(app *backpack.App) error {
return nil
}
// Commands registers faq:import-winter.
func (p *Plugin) Commands() []bonfire.Command {
return []bonfire.Command{console.ImportWinter(p.app)}
}
func (p *Plugin) Migrations() []*gormigrate.Migration { return updates.All() }
func (p *Plugin) Models() []any { return models.All() }