generate

package
v1.66.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package generate writes the migration an ent schema change needs, for goback's own index and for anything built on goback that keeps its own schema the same way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, schema Schema, options Options, dialects ...string) error

Run appends a migration to the directory of each dialect, migrations.SQLite or migrations.Postgres, whose schema changed, and logs what it did. SQLite diffs against an in-memory database.

Types

type Options

type Options struct {
	// Root holds one migration directory per dialect, named after it.
	Root string
	// Name is the name of the migration written.
	Name string
	// PostgresURL is an empty Postgres database; empty starts a container.
	PostgresURL string
}

Options says where migrations go and what Postgres to diff against.

type Schema

type Schema func(db *sql.DB, dialect string) migrations.Differ

Schema is the ent schema to diff over db, a scratch database of the dialect; a generated ent migrate package's NewSchema over db fits.

Jump to

Keyboard shortcuts

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