New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: split queries.sql into files by table #762
Conversation
Codecov Report
@@ Coverage Diff @@
## main #762 +/- ##
==========================================
+ Coverage 64.25% 65.93% +1.67%
==========================================
Files 199 200 +1
Lines 11861 13179 +1318
Branches 87 87
==========================================
+ Hits 7621 8689 +1068
- Misses 3420 3603 +183
- Partials 820 887 +67
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of the Go files this generates.
It misuses _
inside of Go file names, and makes the majority of files in the database package generated, which makes others harder to read.
Is it possible to output all generated into a single file like before? I love the separated SQL files, but it seems unnecessary to have separated generated Go files.
11b8685
to
3fe4153
Compare
@@ -30,6 +30,7 @@ CREATE TABLE projects ( | |||
|
|||
-- Enforces no active projects have the same name. | |||
CREATE UNIQUE INDEX ON projects (organization_id, name) WHERE deleted = FALSE; | |||
CREATE UNIQUE INDEX idx_projects_name_lower ON projects USING btree (lower(name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kylecarbs we seemed to be querying these by their lowercase names so I added indexes for them as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh wise. Good change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things! Neat change.
--output ./coderd/database/query.sql | ||
sed -i 's/@ /@/g' ./coderd/database/query.sql | ||
fmt/sql: $(wildcard coderd/database/queries/*.sql) | ||
# TODO: this is slightly slow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use bash wait to make this faster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The biggest problem is that it has to attempt to install via npx
every time, otherwise it's pretty fast! Can npx
be called concurrently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhhhh. I say we require sql-formatter
installed globally then.
ead9ba0
to
303297c
Compare
No description provided.