package db

import "git.dotya.ml/mirre-mt/pcmt/modules/db"

Index

Functions

func IsSetUp

func IsSetUp(ctx context.Context, client *ent.Client) (bool, error)

IsSetUp checks if the database has previously been set up.

func PrintMigration

func PrintMigration(ctx context.Context, client *ent.Client) error

PrintMigration prints the upcoming migration to stdout.

func SetUp

func SetUp(ctx context.Context, client *ent.Client, createAdmin bool, initPasswd string) error

SetUp attempts to automatically migrate DB schema and creates the set-up record indicating that the DB has been set up. Optionally and only if the DB has not been set up prior, it creates and admin user with the initPasswd and the default username and email (see ../user/const.go).

Types

type CtxKey

type CtxKey struct{}

CtxKey serves as a key to context values for this package.

Source Files

db.go

Version
v0.0.0-20230910121657-4d10510f5ba4 (latest)
Published
Sep 10, 2023
Platform
linux/amd64
Imports
8 packages
Last checked
1 month ago

Tools for package owners.