Skip to content

chore: update v1 schema#643

Merged
coadler merged 3 commits into
mainfrom
colin/uuid-schema
Apr 1, 2022
Merged

chore: update v1 schema#643
coadler merged 3 commits into
mainfrom
colin/uuid-schema

Conversation

@coadler
Copy link
Copy Markdown
Contributor

@coadler coadler commented Mar 29, 2022

Now uses UUIDs for users, organizations, organization members, and api keys. Also updates the v1 migration to correctly create indexes and foreign keys that were missed previously.

@coadler coadler self-assigned this Mar 29, 2022
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 29, 2022

Codecov Report

Merging #643 (da23bf5) into main (efec029) will increase coverage by 1.99%.
The diff coverage is 80.21%.

@@            Coverage Diff             @@
##             main     #643      +/-   ##
==========================================
+ Coverage   62.07%   64.06%   +1.99%     
==========================================
  Files         113      199      +86     
  Lines       10755    11861    +1106     
  Branches        0       87      +87     
==========================================
+ Hits         6676     7599     +923     
- Misses       3296     3439     +143     
- Partials      783      823      +40     
Flag Coverage Δ
unittest-go- 63.04% <80.21%> (?)
unittest-go-macos-latest 59.00% <80.21%> (+0.15%) ⬆️
unittest-go-ubuntu-latest 61.76% <80.21%> (-0.06%) ⬇️
unittest-go-windows-2022 58.02% <79.67%> (?)
unittest-js 62.63% <ø> (?)
Impacted Files Coverage Δ
cli/parameters.go 16.07% <0.00%> (-0.30%) ⬇️
cli/workspacedelete.go 17.64% <0.00%> (ø)
cli/workspacelist.go 9.52% <0.00%> (ø)
cli/workspaces.go 51.61% <0.00%> (ø)
cli/workspaceshow.go 14.28% <0.00%> (ø)
cli/workspacestart.go 15.15% <0.00%> (ø)
cli/workspacestop.go 13.88% <0.00%> (ø)
cli/workspaceupdate.go 7.89% <0.00%> (ø)
codersdk/projects.go 60.37% <ø> (ø)
codersdk/workspacebuilds.go 58.33% <ø> (ø)
... and 129 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efec029...da23bf5. Read the comment docs.

@coadler coadler force-pushed the colin/uuid-schema branch 4 times, most recently from 0f51d90 to bd149b1 Compare March 30, 2022 22:31
@coadler coadler marked this pull request as ready for review March 30, 2022 22:45
@coadler coadler requested a review from kylecarbs March 30, 2022 22:45
Copy link
Copy Markdown
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's trim down the initial migration as much as we possibly can. The initial schema should be 90% v2, and just supporting v1 in a very soft way.

Comment thread coderd/httpmw/httpmw.go Outdated
httpapi.Write(rw, http.StatusNotFound, httpapi.Response{
Message: fmt.Sprintf("organization %q does not exist", organizationID),
})
orgID, ok := parseUUID(rw, r, "organization")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why abbreviate here and not for organization? We should be consistent with abbreviations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessarily important for local variables, organization is a lot to type every time. IMO it's only important for exported variables and function params.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bit of an arbitrarily drawn line though. It's more to type, but an inconsistent naming scheme hurts readability.

Comment thread coderd/httpmw/organizationparam.go
Comment thread examples/examples.go
returnError = xerrors.Errorf("example %q does not contain README.md", exampleID)
return
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather add a linting rule to enforce newline conventions. Arbitrarily doing it on a per-developer basis will read to inconsistency when reading our code.

Comment thread coderd/database/migrations/000003_workspaces.up.sql
Comment thread coderd/database/migrations/000001_base.up.sql Outdated
Comment thread coderd/database/migrations/000001_base.up.sql Outdated
Comment thread coderd/database/migrations/000001_base.up.sql
Comment thread coderd/database/migrations/000001_base.up.sql Outdated
Comment thread coderd/database/migrations/000001_base.up.sql Outdated
@coadler coadler force-pushed the colin/uuid-schema branch 5 times, most recently from 9a63ac3 to 2a61e73 Compare March 31, 2022 18:22
@coadler coadler requested a review from kylecarbs March 31, 2022 18:26
Copy link
Copy Markdown
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good changes! One minor nit, but that's all.

Comment on lines 21 to 22
revoked boolean NOT NULL,
login_type login_type NOT NULL,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These could be removed too!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is referenced a bunch in the code, I'd rather remove these after.

@coadler coadler force-pushed the colin/uuid-schema branch from 2a61e73 to da23bf5 Compare April 1, 2022 18:57
@coadler coadler merged commit 2b1a0ee into main Apr 1, 2022
@coadler coadler deleted the colin/uuid-schema branch April 1, 2022 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants