Feat: Add development bootstrap reset
This commit is contained in:
@@ -410,6 +410,36 @@ func (service *Service) SaveStructure(ctx context.Context, input SaveStructureIn
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (service *Service) ResetDevelopmentState(ctx context.Context) error {
|
||||
tx, err := service.db.Pool.BeginTx(ctx, pgx.TxOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
_ = tx.Rollback(ctx)
|
||||
}()
|
||||
|
||||
if _, err := tx.Exec(ctx, `
|
||||
TRUNCATE TABLE
|
||||
project_memberships,
|
||||
team_memberships,
|
||||
organization_memberships,
|
||||
workspaces,
|
||||
projects,
|
||||
teams,
|
||||
departments,
|
||||
user_homes,
|
||||
users,
|
||||
organizations,
|
||||
installations
|
||||
RESTART IDENTITY;
|
||||
`); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tx.Commit(ctx)
|
||||
}
|
||||
|
||||
func (service *Service) GetInstallation(ctx context.Context) (*InstallationRecord, error) {
|
||||
record, err := scanInstallationRecord(service.db.Pool.QueryRow(ctx, `
|
||||
SELECT id::text, mode::text, access::text, protocol::text, host, is_bootstrapped
|
||||
|
||||
Reference in New Issue
Block a user