migrations

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package migrations holds migrations related helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIndex

func CreateIndex(ctx context.Context, db bun.IDB, tableName, indexName, columns string) error

CreateIndex creates an index on the database

func CreateIndexes

func CreateIndexes(ctx context.Context, db bun.IDB, tableName string, columns ...string) error

CreateIndexes creates multiple indexes on the table for the given columns. Index names are generated as idx_<table>_<column>.

func CreateModelIndexes

func CreateModelIndexes(ctx context.Context, db bun.IDB, model any, columns ...string) error

CreateModelIndexes creates multiple indexes on the table associated with the model.

func CreateModelUniqueIndexes

func CreateModelUniqueIndexes(ctx context.Context, db bun.IDB, model any, columns ...string) error

CreateModelUniqueIndexes creates multiple unique indexes on the table associated with the model.

func CreateSchema

func CreateSchema(ctx context.Context, db bun.IDB, models ...any) error

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 DropIndex

func DropIndex(ctx context.Context, db bun.IDB, indexName string) error

DropIndex drops an index from the database.

func DropModelIndexes

func DropModelIndexes(ctx context.Context, db bun.IDB, model any, columns ...string) error

DropModelIndexes drops indexes from the database using model + column names.

func DropTables

func DropTables(ctx context.Context, db bun.IDB, models ...any) error

DropTables drops tables from database

func Exitf

func Exitf(s string, args ...any)

Exitf exits command printing usage

func InsertEntry

func InsertEntry(ctx context.Context, db bun.IDB, entries ...any) error

InsertEntry inserts entries to the db

func RunMigrations

func RunMigrations(migrator *migrate.Migrator, args ...string) error

RunMigrations runs migrations based on provided command arguments

func TruncateTables

func TruncateTables(ctx context.Context, db bun.IDB, models ...any) error

TruncateTables removes entries from tables

func Usage

func Usage()

Usage prints command usage

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL