Added announcement support and list migrations.
This commit is contained in:
parent
5e0963042f
commit
c85a59d2ad
4 changed files with 52 additions and 9 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue