core/internal/bun/migrations/20240508043508_servers_add_snapshot_created_at_column.go
Dawid Wysokiński 08a7f0c504
Some checks failed
ci/woodpecker/push/govulncheck Pipeline failed
ci/woodpecker/push/test Pipeline failed
feat: server snapshots (#49)
Reviewed-on: #49
2024-05-09 07:49:04 +00:00

18 lines
428 B
Go

package migrations
import (
"context"
"github.com/uptrace/bun"
)
func init() {
migrations.MustRegister(func(ctx context.Context, db *bun.DB) error {
_, err := db.ExecContext(ctx, "ALTER TABLE servers ADD snapshot_created_at timestamp with time zone")
return err
}, func(ctx context.Context, db *bun.DB) error {
_, err := db.ExecContext(ctx, "ALTER TABLE servers DROP COLUMN snapshot_created_at")
return err
})
}