Skip to content

Commit b145dc0

Browse files
feat(store): add deleted_at to domains, billing checkouts, and billing transactions (#1927)
1 parent 26667e5 commit b145dc0

5 files changed

Lines changed: 18 additions & 9 deletions

File tree

‎internal/store/postgres/billing_checkout_repository.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type Checkout struct {
5959
CreatedAt time.Time `db:"created_at"`
6060
UpdatedAt time.Time `db:"updated_at"`
6161
ExpireAt *time.Time `db:"expire_at"`
62+
DeletedAt *time.Time `db:"deleted_at"`
6263
}
6364

6465
func (c Checkout) transform() (checkout.Checkout, error) {

‎internal/store/postgres/billing_transactions_repository.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ type Transaction struct {
4242
UserID *string `db:"user_id"`
4343
Metadata types.NullJSONText `db:"metadata"`
4444

45-
CreatedAt time.Time `db:"created_at"`
46-
UpdatedAt time.Time `db:"updated_at"`
45+
CreatedAt time.Time `db:"created_at"`
46+
UpdatedAt time.Time `db:"updated_at"`
47+
DeletedAt *time.Time `db:"deleted_at"`
4748
}
4849

4950
func (c Transaction) transform() (credit.Transaction, error) {

‎internal/store/postgres/domain.go‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import (
77
)
88

99
type Domain struct {
10-
ID string `db:"id"`
11-
OrgID string `db:"org_id"`
12-
Name string `db:"name"`
13-
Token string `db:"token"`
14-
State string `db:"state"`
15-
UpdatedAt time.Time `db:"updated_at"`
16-
CreatedAt time.Time `db:"created_at"`
10+
ID string `db:"id"`
11+
OrgID string `db:"org_id"`
12+
Name string `db:"name"`
13+
Token string `db:"token"`
14+
State string `db:"state"`
15+
UpdatedAt time.Time `db:"updated_at"`
16+
CreatedAt time.Time `db:"created_at"`
17+
DeletedAt *time.Time `db:"deleted_at"`
1718
}
1819

1920
func (d Domain) transform() domain.Domain {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE domains DROP COLUMN IF EXISTS deleted_at;
2+
ALTER TABLE billing_checkouts DROP COLUMN IF EXISTS deleted_at;
3+
ALTER TABLE billing_transactions DROP COLUMN IF EXISTS deleted_at;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE domains ADD COLUMN IF NOT EXISTS deleted_at timestamptz;
2+
ALTER TABLE billing_checkouts ADD COLUMN IF NOT EXISTS deleted_at timestamptz;
3+
ALTER TABLE billing_transactions ADD COLUMN IF NOT EXISTS deleted_at timestamptz;

0 commit comments

Comments
 (0)