Documentation
¶
Overview ¶
Package migrations holds migrations related helpers
Index ¶
- func CreateIndex(ctx context.Context, db bun.IDB, tableName, indexName, columns string) error
- func CreateIndexes(ctx context.Context, db bun.IDB, tableName string, columns ...string) error
- func CreateModelIndexes(ctx context.Context, db bun.IDB, model any, columns ...string) error
- func CreateModelUniqueIndexes(ctx context.Context, db bun.IDB, model any, columns ...string) error
- func CreateSchema(ctx context.Context, db bun.IDB, models ...any) error
- func CreateUniqueIndexes(ctx context.Context, db bun.IDB, tableName string, columns ...string) error
- func DropIndex(ctx context.Context, db bun.IDB, indexName string) error
- func DropModelIndexes(ctx context.Context, db bun.IDB, model any, columns ...string) error
- func DropTables(ctx context.Context, db bun.IDB, models ...any) error
- func Exitf(s string, args ...any)
- func InsertEntry(ctx context.Context, db bun.IDB, entries ...any) error
- func RunMigrations(migrator *migrate.Migrator, args ...string) error
- func TruncateTables(ctx context.Context, db bun.IDB, models ...any) error
- func Usage()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateIndex ¶
CreateIndex creates an index on the database
func CreateIndexes ¶
CreateIndexes creates multiple indexes on the table for the given columns. Index names are generated as idx_<table>_<column>.
func CreateModelIndexes ¶
CreateModelIndexes creates multiple indexes on the table associated with the model.
func CreateModelUniqueIndexes ¶
CreateModelUniqueIndexes creates multiple unique indexes on the table associated with the model.
func CreateSchema ¶
CreateSchema creates schema from models
func CreateUniqueIndexes ¶
func CreateUniqueIndexes(ctx context.Context, db bun.IDB, tableName string, columns ...string) error
CreateUniqueIndexes creates multiple unique indexes on the table for the given columns. Index names are generated as idx_<table>_<column>.
func DropModelIndexes ¶
DropModelIndexes drops indexes from the database using model + column names.
func DropTables ¶
DropTables drops tables from database
func InsertEntry ¶
InsertEntry inserts entries to the db
func RunMigrations ¶
RunMigrations runs migrations based on provided command arguments
func TruncateTables ¶
TruncateTables removes entries from tables
Types ¶
This section is empty.