signoz/pkg/sqlmigrator/000_noop.go
Vibhu Pandey 268f283785
feat(sqlmigrator): add sqlmigrator package (#6836)
### Summary

- add sqlmigrator package
2025-01-17 16:52:55 +05:30

33 lines
806 B
Go

package sqlmigrator
import (
"context"
"github.com/uptrace/bun"
"github.com/uptrace/bun/migrate"
"go.signoz.io/signoz/pkg/factory"
)
type noopMigration struct{}
func NoopMigrationFactory() factory.ProviderFactory[SQLMigration, Config] {
return factory.NewProviderFactory(factory.MustNewName("noop"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
return &noopMigration{}, nil
})
}
func (migration *noopMigration) Register(migrations *migrate.Migrations) error {
if err := migrations.Register(migration.Up, migration.Down); err != nil {
return err
}
return nil
}
func (migration *noopMigration) Up(ctx context.Context, db *bun.DB) error {
return nil
}
func (migration *noopMigration) Down(ctx context.Context, db *bun.DB) error {
return nil
}