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
24 lines
690 B
PL/PgSQL
24 lines
690 B
PL/PgSQL
begin;
|
|
|
|
create function wt_add_seconds(sec integer, ts timestamp with time zone)
|
|
returns timestamp with time zone
|
|
as $$
|
|
select ts + sec * '1 second'::interval;
|
|
$$ language sql
|
|
stable
|
|
returns null on null input;
|
|
comment on function wt_add_seconds is
|
|
'wt_add_seconds returns ts + sec.';
|
|
|
|
create function wt_add_seconds_to_now(sec integer)
|
|
returns timestamp with time zone
|
|
as $$
|
|
select wt_add_seconds(sec, current_timestamp);
|
|
$$ language sql
|
|
stable
|
|
returns null on null input;
|
|
comment on function wt_add_seconds_to_now is
|
|
'wt_add_seconds_to_now returns current_timestamp + sec.';
|
|
|
|
commit;
|