chore: Force license uuids to not be null (#6012)

* chore: Force license uuids to not be null

* All unit tests generate uuids for licenses

* Update migration files to new numbers

* Put migration in transaction
This commit is contained in:
Steven Masley
2023-02-13 18:21:58 -06:00
committed by GitHub
parent a54de6093b
commit 733f58c76d
11 changed files with 39 additions and 25 deletions
+8 -8
View File
@@ -1363,7 +1363,7 @@ func (q *sqlQuerier) GetLicenses(ctx context.Context) ([]License, error) {
&i.UploadedAt,
&i.JWT,
&i.Exp,
&i.Uuid,
&i.UUID,
); err != nil {
return nil, err
}
@@ -1399,7 +1399,7 @@ func (q *sqlQuerier) GetUnexpiredLicenses(ctx context.Context) ([]License, error
&i.UploadedAt,
&i.JWT,
&i.Exp,
&i.Uuid,
&i.UUID,
); err != nil {
return nil, err
}
@@ -1427,10 +1427,10 @@ VALUES
`
type InsertLicenseParams struct {
UploadedAt time.Time `db:"uploaded_at" json:"uploaded_at"`
JWT string `db:"jwt" json:"jwt"`
Exp time.Time `db:"exp" json:"exp"`
Uuid uuid.NullUUID `db:"uuid" json:"uuid"`
UploadedAt time.Time `db:"uploaded_at" json:"uploaded_at"`
JWT string `db:"jwt" json:"jwt"`
Exp time.Time `db:"exp" json:"exp"`
UUID uuid.UUID `db:"uuid" json:"uuid"`
}
func (q *sqlQuerier) InsertLicense(ctx context.Context, arg InsertLicenseParams) (License, error) {
@@ -1438,7 +1438,7 @@ func (q *sqlQuerier) InsertLicense(ctx context.Context, arg InsertLicenseParams)
arg.UploadedAt,
arg.JWT,
arg.Exp,
arg.Uuid,
arg.UUID,
)
var i License
err := row.Scan(
@@ -1446,7 +1446,7 @@ func (q *sqlQuerier) InsertLicense(ctx context.Context, arg InsertLicenseParams)
&i.UploadedAt,
&i.JWT,
&i.Exp,
&i.Uuid,
&i.UUID,
)
return i, err
}