Skip to content

Commit

Permalink
Add soft deletes to loadbalancer api (#320)
Browse files Browse the repository at this point in the history
* Init softdeletes

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>

* Update loadbalancer hooks

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>

* Fix delete event type so an appropriate nats message is generated

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>

* Add softdelete to remaining schemas

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>

* fix lint

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>

* Fix migrations

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>

* Add LB History resolver

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>

* Generate resolver

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>

---------

Signed-off-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>
Co-authored-by: Tyler Auerbeck <tylerauerbeck@users.noreply.github.com>
  • Loading branch information
tylerauerbeck and tylerauerbeck authored Feb 8, 2024
1 parent 8478791 commit 9f8e7ee
Show file tree
Hide file tree
Showing 50 changed files with 7,047 additions and 1,092 deletions.
23 changes: 23 additions & 0 deletions db/migrations/20240208121103_softdelete.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- +goose Up
-- modify "load_balancers" table
ALTER TABLE "load_balancers" ADD COLUMN "deleted_at" timestamptz NULL, ADD COLUMN "deleted_by" character varying NULL;
-- modify "origins" table
ALTER TABLE "origins" ADD COLUMN "deleted_at" timestamptz NULL, ADD COLUMN "deleted_by" character varying NULL;
-- modify "pools" table
ALTER TABLE "pools" ADD COLUMN "deleted_at" timestamptz NULL, ADD COLUMN "deleted_by" character varying NULL;
-- modify "ports" table
ALTER TABLE "ports" ADD COLUMN "deleted_at" timestamptz NULL, ADD COLUMN "deleted_by" character varying NULL;
-- modify "providers" table
ALTER TABLE "providers" ADD COLUMN "deleted_at" timestamptz NULL, ADD COLUMN "deleted_by" character varying NULL;

-- +goose Down
-- reverse: modify "providers" table
ALTER TABLE "providers" DROP COLUMN "deleted_by", DROP COLUMN "deleted_at";
-- reverse: modify "ports" table
ALTER TABLE "ports" DROP COLUMN "deleted_by", DROP COLUMN "deleted_at";
-- reverse: modify "pools" table
ALTER TABLE "pools" DROP COLUMN "deleted_by", DROP COLUMN "deleted_at";
-- reverse: modify "origins" table
ALTER TABLE "origins" DROP COLUMN "deleted_by", DROP COLUMN "deleted_at";
-- reverse: modify "load_balancers" table
ALTER TABLE "load_balancers" DROP COLUMN "deleted_by", DROP COLUMN "deleted_at";
3 changes: 2 additions & 1 deletion db/migrations/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
h1:VbjEjTYQpHluH7ZPRqCN9Xz2sRkWFqFjgcQjf19L/xo=
h1:0KtiTooJCnoUsSF1CYnlRKEVEQFmH2Fj55S/41WmJr8=
20230503185445_initial-migration.sql h1:4pqNp2MDBBRdGxU/H5mmZui9oi1SyjIiMVGatajrBeY=
20230615194819_drop_tenant_add_owner.sql h1:KGCsItU0NYhxYEkhZOaMQjfIrBMnek5rxC6D/LhnyCk=
20230629085916_drop_status_and_annotations.sql h1:kvDMoaMEjyoj/aRi6rw4XvCLxGH09vGGLbL0/p5tpPo=
20231017005257_add_origin_weight.sql h1:NuorUbcydDqcyPK8wgwlkQxaH+zGWfVtJW9UPL1Vn+E=
20240207205734_audit-fields.sql h1:cplFCBB7laCP5Y+UAoxIfITMo56Hoc5XIVvgcfGL9o0=
20240208121103_softdelete.sql h1:rt3nHn/1KzxSAbJZ33fQJZi5emLk7Q2PCRcfxWUeveY=
15 changes: 10 additions & 5 deletions internal/ent/generated/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions internal/ent/generated/gql_collection.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9f8e7ee

Please sign in to comment.