This refactors the schema package and subpackages to support editions.
An Edition is a collection of sql migrations. A given boundary binary
can have multiple migration editions. The `schema.Manager` is updated to
apply the necessary migrations in the correct order, leveraging an
Edition's priority to determine the order in which the separate Editions
are applied.
The sql migration files are now nested under a directory for the
edition.
This also switches from the generated code to using embed, which
eliminates the need for the `make migrations` target and the generated
code. As such this commit removes the target and generated code.
See:
https://pkg.go.dev/embed
18 lines
404 B
Go
18 lines
404 B
Go
// Package oss is used to embed the sql statements for the oss edition and
|
|
// registering the edition for the schema.Manager.
|
|
package oss
|
|
|
|
import (
|
|
"embed"
|
|
|
|
"github.com/hashicorp/boundary/internal/db/schema"
|
|
)
|
|
|
|
// postgres contains the migrations sql files for postgres oss edition
|
|
//go:embed postgres
|
|
var postgres embed.FS
|
|
|
|
func init() {
|
|
schema.RegisterEdition("oss", schema.Postgres, postgres, 0)
|
|
}
|