Added announcement support and list migrations.

This commit is contained in:
Benjamin A. Shelton 2026-10-26 15:27:46 -06:00
commit c85a59d2ad
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
4 changed files with 52 additions and 9 deletions

View file

@ -135,6 +135,7 @@ func (b *birthday) ListBirthdays(ctx context.Context, cmd *cli.Command) error {
logger.SetLevel(logging.Info)
chatid := cmd.Int64("chatid")
annunciate := cmd.Bool("annunciate")
mdb := models.OpenDatabase(ctx, b.settings)
if err := mdb.Open(); err != nil {
@ -165,7 +166,13 @@ func (b *birthday) ListBirthdays(ctx context.Context, cmd *cli.Command) error {
logger.Error("cannot parse date:", bday.Birthdate)
continue
}
logger.Infof(" • %s (%s)", bday.Name, d.Format("January 2"))
if annunciate {
logger.Infof(" • %s (%s) (announce: %v)", bday.Name,
d.Format("January 2"), bday.Announce)
} else {
logger.Infof(" • %s (%s)", bday.Name,
d.Format("January 2"))
}
}
return nil
}

View file

@ -11,6 +11,7 @@ import (
"go.destrealm.net/embedder"
"go.destrealm.net/errors"
"go.destrealm.net/logging/v3"
"go.destrealm.net/migratory"
"go.destrealm.net/vfs"
)
@ -52,3 +53,21 @@ func (inst *installer) DoInstall(ctx context.Context, cmd *cli.Command) error {
func (inst *installer) DoUp(ctx context.Context, cmd *cli.Command) error {
return inst.DoInstall(ctx, cmd)
}
func (inst *installer) ListMigrations(ctx context.Context, cmd *cli.Command) error {
mg, err := migratory.New(inst.settings.System.DSN)
if err != nil {
return err
}
mg.UsingVFS(inst.fs)
migrator, err := mg.Migrate("migrations/sqlite")
if err != nil {
return err
}
for _, m := range migrator.Migrations() {
fmt.Println(m)
}
return nil
}