-
Notifications
You must be signed in to change notification settings - Fork 19
[Doc] Getting Started - Database #313
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a67ea87
[Doc] Database - Init Page
LatentDream 87a759e
draft
LatentDream 9c53686
how to connect
LatentDream 8c5662b
fix: typo / better sentence
LatentDream 60caf08
cursor it for better doc :)
LatentDream 379c967
fix: indexing page section
LatentDream File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # Deploy a Database | ||
|
|
||
| ## 1. Click on "Database" -> "New" | ||
|  | ||
|
|
||
| ## 2. Fill out the form | ||
| Here you'll need to choose a Database name, a username and password. Herre, you also have the option to change the default hardware on which your database will be running. | ||
|  | ||
|
|
||
| ```{important} | ||
| Generate a strong password, preferably with a mix of uppercase and lowercase letters, numbers, and special characters. Store this password securely as you'll need it to connect to your database. | ||
| ``` | ||
|
|
||
| ## 3. Wait for the deployment to finish | ||
| Once created, the database will be deployed, this can take up to a minute. When your database is running, you are ready to connect to it. | ||
|  | ||
|
|
||
| ## 4. Connecting to your Database | ||
| Once your database is deployed, you can connect to it directly from the CLI, or through tools like [pgAdmin](https://www.pgadmin.org/). | ||
|
|
||
| ### Connecting to your Database from the CLI | ||
| To connect to the database from the terminal, you'll first need psql, which can be installed with: | ||
|
|
||
| ```sh | ||
| # For Debian/Ubuntu | ||
| sudo apt-get install postgresql-client | ||
|
|
||
| # For macOS using Homebrew | ||
| brew install libpq | ||
| brew link --force libpq | ||
|
|
||
| # For Windows | ||
| # Download the installer from https://www.postgresql.org/download/windows/ | ||
| ``` | ||
|
|
||
| Once installed, copy the PSQL command from the UI into your terminal to directly connect to your database. This will prompt you for the password. This one can be found above the PSQL command. | ||
|
|
||
|  | ||
|
|
||
| ```sh | ||
| $ psql -h {DATABASE-URL} -U {USERNAME} {DATABASE_NAME} | ||
| Password for user ...: {DATABASE_PASSWORD} | ||
| ``` | ||
|
|
||
| Congratulations, you are now connected to your database! | ||
|
|
||
| You can run the following commands to create a new table: | ||
|
|
||
| ```sql | ||
| CREATE TABLE users ( | ||
| id SERIAL PRIMARY KEY, | ||
| username VARCHAR(100) UNIQUE NOT NULL, | ||
| email VARCHAR(255) UNIQUE NOT NULL, | ||
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | ||
| ); | ||
|
|
||
| -- Insert a test user | ||
| INSERT INTO users (username, email) VALUES ('testuser', 'test@example.com'); | ||
|
|
||
| -- Verify the insertion | ||
| SELECT * FROM users; | ||
| ``` | ||
|
|
||
| ### Connecting to your Database from pgAdmin | ||
|
|
||
| 1. Open pgAdmin on your computer | ||
| 2. Right-click on "Servers" in the browser panel and select "Create" > "Server..." | ||
| 3. In the "General" tab, enter a name for your server connection | ||
| 4. Switch to the "Connection" tab and enter the following details: | ||
| - Host name/address: Your database URL (from the UI) | ||
| - Port: 5432 (default PostgreSQL port) | ||
| - Maintenance database: Your database name | ||
| - Username: Your database username | ||
| - Password: Your database password | ||
| 5. Click "Save" to connect to your database | ||
| 6. Your database will appear in the server list, and you can expand it to see tables and other objects | ||
|
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
there are some typos and style could be better.
you can use cursor to fix this. it'll usually stop editing once it finds the beginning of a snippet, (```), you can use (~~~) to prevent that
you can prompt it like
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.
Generated a new version, cursor is way better for this specific usecase then a normal llm 😎 - Preview here