Skip to content

Commit

Permalink
Rename '' filetype to 'unknown'
Browse files Browse the repository at this point in the history
  • Loading branch information
bcspragu committed Jan 16, 2024
1 parent 69a9def commit 2352743
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion db/sqldb/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ func validateBlobForCreation(b *pacta.Blob) error {
if b.BlobURI == "" {
return fmt.Errorf("blob missing BlobURI")
}
if b.FileType == "" {
return fmt.Errorf("blob missing FileType")
}
if b.FileName == "" {
return fmt.Errorf("blob missing FileName")
}
// A blank FileType is valid, just means we don't recognize the file type yet.
return nil
}
2 changes: 1 addition & 1 deletion db/sqldb/golden/human_readable_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ CREATE TYPE file_type AS ENUM (
'css',
'js',
'ttf',
'');
'unknown');
CREATE TYPE language AS ENUM (
'en',
'de',
Expand Down
2 changes: 1 addition & 1 deletion db/sqldb/golden/schema_dump.sql
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ CREATE TYPE public.file_type AS ENUM (
'css',
'js',
'ttf',
''
'unknown'
);


Expand Down
2 changes: 1 addition & 1 deletion db/sqldb/migrations/0011_add_report_file_types.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ ALTER TYPE file_type ADD VALUE 'txt';
ALTER TYPE file_type ADD VALUE 'css';
ALTER TYPE file_type ADD VALUE 'js';
ALTER TYPE file_type ADD VALUE 'ttf';
ALTER TYPE file_type ADD VALUE ''; -- Unknown file types
ALTER TYPE file_type ADD VALUE 'unknown';

COMMIT;
4 changes: 2 additions & 2 deletions pacta/pacta.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const (
FileType_CSS = "css"
FileType_JS = "js"
FileType_TTF = "ttf"
FileType_UNKNOWN = ""
FileType_UNKNOWN = "unknown"
)

var FileTypeValues = []FileType{
Expand Down Expand Up @@ -253,7 +253,7 @@ func ParseFileType(s string) (FileType, error) {
return FileType_JS, nil
case "ttf":
return FileType_TTF, nil
case "":
case "unknown":
return FileType_UNKNOWN, nil
}
return "", fmt.Errorf("unknown pacta.FileType: %q", s)
Expand Down

0 comments on commit 2352743

Please sign in to comment.