added 'deleted' flags to all store objects (#262)

This commit is contained in:
Michael Quigley 2023-03-09 15:08:59 -05:00
parent 43d51a8f14
commit a0e94330c7
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
10 changed files with 27 additions and 1 deletions

View File

@ -12,6 +12,7 @@ type Account struct {
Password string
Token string
Limitless bool
Deleted bool
}
func (self *Store) CreateAccount(a *Account, tx *sqlx.Tx) (int, error) {

View File

@ -14,6 +14,7 @@ type AccountRequest struct {
Token string
Email string
SourceAddress string
Deleted bool
}
func (self *Store) CreateAccountRequest(ar *AccountRequest, tx *sqlx.Tx) (int, error) {

View File

@ -12,6 +12,7 @@ type Environment struct {
Host string
Address string
ZId string
Deleted bool
}
func (self *Store) CreateEnvironment(accountId int, i *Environment, tx *sqlx.Tx) (int, error) {

View File

@ -13,6 +13,7 @@ type Frontend struct {
PublicName *string
UrlTemplate *string
Reserved bool
Deleted bool
}
func (str *Store) CreateFrontend(envId int, f *Frontend, tx *sqlx.Tx) (int, error) {

View File

@ -10,7 +10,8 @@ import (
type InviteToken struct {
Model
Token string
Token string
Deleted bool
}
func (str *Store) CreateInviteTokens(inviteTokens []*InviteToken, tx *sqlx.Tx) error {

View File

@ -13,6 +13,7 @@ type PasswordResetRequest struct {
Model
Token string
AccountId int
Deleted bool
}
func (self *Store) CreatePasswordResetRequest(prr *PasswordResetRequest, tx *sqlx.Tx) (int, error) {

View File

@ -16,6 +16,7 @@ type Share struct {
FrontendEndpoint *string
BackendProxyEndpoint *string
Reserved bool
Deleted bool
}
func (self *Store) CreateShare(envId int, shr *Share, tx *sqlx.Tx) (int, error) {

View File

@ -0,0 +1,9 @@
-- +migrate Up
alter table account_requests add column deleted boolean not null default(false);
alter table accounts add column deleted boolean not null default(false);
alter table environments add column deleted boolean not null default(false);
alter table frontends add column deleted boolean not null default(false);
alter table invite_tokens add column deleted boolean not null default(false);
alter table password_reset_requests add column deleted boolean not null default(false);
alter table shares add column deleted boolean not null default(false);

View File

@ -0,0 +1,9 @@
-- +migrate Up
alter table account_requests add column deleted boolean not null default(false);
alter table accounts add column deleted boolean not null default(false);
alter table environments add column deleted boolean not null default(false);
alter table frontends add column deleted boolean not null default(false);
alter table invite_tokens add column deleted boolean not null default(false);
alter table password_reset_requests add column deleted boolean not null default(false);
alter table shares add column deleted boolean not null default(false);

View File

@ -18,6 +18,7 @@ type Model struct {
Id int
CreatedAt time.Time
UpdatedAt time.Time
Deleted bool
}
type Config struct {