-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Node revamp: PostgreSQL lessons #27960
base: main
Are you sure you want to change the base?
Conversation
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.
For installing_postgresql.md
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
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.
Absolute 🔥
For using_postgresql.md
:
Mainly just tiny wording nits
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
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'll add my approval now, though of course we'll probably want to wait for any others to get a chance to review.
|
||
<details markdown="block"> | ||
|
||
<summary class="dropDown-header">Linux</summary> |
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.
@MaoShizhong From your comment on the other PR, yeah the way we're doing these details/summary elements isn't great. Right now the heading structure from an AT perspective is essentially:
- Installing PostgresSQL
- Step 1: Make sure the system is up to date
- ....other headings....
- Step 1: Make sure the system is up to date
Without any context of an OS anywhere. We could put this in as is as I'm not 100% sure how best to go about it yet. We could have the actual steps be visible at all times, then in each step have a details/summary per OS, so something like the following screenshot:
Since the content of the summary
element can't be given a Markdown heading (we could use HTML h3
etc, but then we need to allow that in the lint rules). But I'd have to stew on it a bit more probably.
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.
@thatblindgeye I straight up copy pasted the existing lesson in the Rails path in to a new file in this PR. If we do intend to make these changes, might I suggest handling it in a separate PR?
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.
@01zulfi Oh no this is definitely something we're doing in other places, I hope my comment didn't come off as saying this was an issue you introduced or anything.
But yeah, this is something that can be a followup since it is something that will affect other lessons and there's still some ruminating to do on the idea.
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.
All good 😆
I'm suggesting to open a separate issue/PR because this issue is relevant to other installation-esque lessons as well. Anyway, I'm happy to update this PR if we do reach a consensus on how to fix this issue.
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 vote separate PR to handle both this and the Rails version together once decided on the best way to handle this.
Single headings each with OS-specific dropdowns does look appealing, though IIRC @thatblindgeye, I think you mentioned accessibility issues with the current actual method of doing the dropdown itself? Since if we can find an accessible and logical alternative that also conforms to the heading issue, we'd be wanting to update any other lesson that does things like this, like any of the earlier installations lessons
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.
Yeah this all can be a followup
|
||
<summary class="dropDown-header">Linux</summary> | ||
|
||
### Step 1: Make sure the system is up to date |
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 headings in these steps would need to be increased by one level since these are subsections of the larger "Installing PostgreSQL" section. Right now it would come off as this Step 1 section being more separate from "Installing" when it really isn't.
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.
(see above comment)
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.
Really excited with this lesson! Coding along feels on point and it reads really nice, I will go through it again and maybe I can spot something else, but great job as always!
With our initialized `Pool`, we can use the `query` method. Create a new `db/queries.js` file. Upon revising our project requirements, we understand we need two db interactions: getting all usernames and inserting a new username. Let's define these functions: | ||
|
||
```javascript | ||
const pool = require("./pool"); |
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.
const pool = require("./pool"); | |
const db = require("./pool"); |
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 intended for this to stay as pool
, but ended up using db
in the code examples. Let me update to pool
.
Invoke the above two functions in the specific controllers (you might have different function names etc. The important thing is to understand how the db functions are invoked): | ||
|
||
```javascript | ||
const db = require("../db/queries"); |
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've commented above that named the pool module as db
should we name this as query
instead
await query.getAllUsernames();
await query.insertUsername(username);
Or we can make it more modular by creating db/queries/username.js
and have generic names like Username.getAll()
Username.insert()
but it's up to you
What do you think?
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'd rather keep it as db
, though at the end of the day I really don't feel strongly towards it. I've updated the other code example., doo let me know what you prefer though after you're read that one; I'll update the lesson accordingly.
Regarding your suggestion on making it modular: I'll trust the learners to refactor as they see fit when they work on bigger projects. They already have all the knowledge they need to do Username.getAll()
or however else they want to refactor.
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.
^ adding to the above, you might've also noticed how barebones the script was compared to the version you wrote (which included utility functions etc). I'd rather have learners come up with this stuff
Co-authored-by: Francis Casibu <[email protected]>
Co-authored-by: Francis Casibu <[email protected]>
Co-authored-by: Francis Casibu <[email protected]>
Co-authored-by: MaoShizhong <[email protected]>
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.
All other comments from me above require followups.
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.
Same - nothing further from me besides anything Nevz or anyone else wishes to bring up 🔥
Because
#27643
This PR
Adds installing and using PostgreSQL lessons
I've opted to separate it into two lessons as that what makes sense to me right now
Issue
Closes #27643
Additional Information
Pull Request Requirements
location of change: brief description of change
format, e.g.Intro to HTML and CSS lesson: Fix link text
Because
section summarizes the reason for this PRThis PR
section has a bullet point list describing the changes in this PRIssue
section