35 lines
553 B
Go
35 lines
553 B
Go
|
package ports
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"ariga.io/atlas/sql/migrate"
|
||
|
"code.icb4dc0.de/prskr/searcherside/internal/ent"
|
||
|
"entgo.io/ent/dialect"
|
||
|
)
|
||
|
|
||
|
type Driver string
|
||
|
|
||
|
const (
|
||
|
DriverPostgres = Driver(dialect.Postgres)
|
||
|
DriverSQLite = Driver(dialect.SQLite)
|
||
|
)
|
||
|
|
||
|
func (t Driver) String() string {
|
||
|
return string(t)
|
||
|
}
|
||
|
|
||
|
type MigrationRequest struct {
|
||
|
Driver Driver
|
||
|
URL string
|
||
|
}
|
||
|
|
||
|
type RevisionReadWriter interface {
|
||
|
migrate.RevisionReadWriter
|
||
|
Client() *ent.Client
|
||
|
}
|
||
|
|
||
|
type Migrator interface {
|
||
|
Migrate(ctx context.Context, req MigrationRequest) error
|
||
|
}
|