mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Moves some of the config into the guides
This commit is contained in:
1 parent
992d8143a5
commit
01b962bf65
4 files changed
+16
-207
No files matched your search
+6
-1
@@ -220,7 +220,12 @@
|
||||
{ "source": "/docs/careers", "destination": "https://about.supabase.com/careers" },
|
||||
{ "source": "/docs/careers/:match*", "destination": "https://about.supabase.com/careers//:match*" },
|
||||
|
||||
{ "source": "/docs/resources", "destination": "/docs/guides" }
|
||||
{ "source": "/docs/resources", "destination": "/docs/guides" },
|
||||
|
||||
{ "source": "/docs/guides/database/resource-management", "destination": "/docs/guides/database/timeouts" },
|
||||
{ "source": "/docs/reference/postgres/database-passwords", "destination": "/docs/guides/database/managing-passwords" },
|
||||
{ "source": "/docs/reference/postgres/changing-timezones", "destination": "/docs/guides/database/managing-timezones" },
|
||||
{ "source": "/docs/reference/postgres/publications", "destination": "/docs/guides/database/replication" }
|
||||
|
||||
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: managing-passwords
|
||||
title: "Managing Database Passwords"
|
||||
title: "Passwords"
|
||||
description: How to change your PostgreSQL database password.
|
||||
---
|
||||
|
||||
@@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
Your PostgreSQL database is the core of your Supabase project, so it's important that it has a strong, secure password at all times.
|
||||
Your passwords should not contain of the following symbols:
|
||||
We recommend avoiding these symbols:
|
||||
|
||||
`: / ? # ] [ @ ! $ & ' ( ) * + , ; =`
|
||||
|
||||
@@ -18,14 +18,7 @@ Special symbols can conflict with connection string URLs, so it's best to avoid
|
||||
### Changing your project password
|
||||
|
||||
When you created your project you were also asked to enter a password. This is actually the password for your database, specifically for the `postgres` user.
|
||||
You can update this password from the Supabase Dashboard](https://supabase.io):
|
||||
|
||||
> @TODO: clean this up. Also we should generate a random password in the code snippet below otherwise everyone will copy/paste the same password.
|
||||
|
||||
- Home
|
||||
- Select a Project
|
||||
- SQL
|
||||
- New Query
|
||||
You can update this using SQL:
|
||||
|
||||
<Tabs
|
||||
defaultValue="SQL"
|
||||
@@ -46,13 +39,14 @@ alter user postgres
|
||||
|
||||
## Creating a secure password
|
||||
|
||||
- use a password manager to generate it
|
||||
- make a long password (10 characters at least)
|
||||
- don't use any common dictionary words
|
||||
- use both upper and lower case characters, numbers, and any symbols not in the list above
|
||||
It's absolutely critical that you store your customers' data safely. Here are some tips for creating a secure password.
|
||||
|
||||
- Use a password manager to generate it.
|
||||
- Make a long password (12 characters at least).
|
||||
- Don't use any common dictionary words.
|
||||
- Use both upper and lower case characters, numbers, and any symbols not in the list above.
|
||||
|
||||
## Resources
|
||||
|
||||
- [Reference: Database Passwords](/docs/reference/postgres/database-passwords)
|
||||
- [PostgreSQL ALTER USER Documentation](https://www.postgresql.org/docs/12/sql-alteruser.html)
|
||||
- [PostgreSQL `ALTER USER` Documentation](https://www.postgresql.org/docs/12/sql-alteruser.html)
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
---
|
||||
id: resource-management
|
||||
title: Resource Management
|
||||
description: Resource management and optimization
|
||||
---
|
||||
|
||||
## Statement Timeouts
|
||||
|
||||
By default, Supabase limits the maximum statement execution time to _3 seconds_ for users accessing the API using the anon key, and _8 seconds_ for authenticated users. Additionally, all users are subject to a global limit of _2 minutes_. This serves as a backstop against resource exhaustion due to either poorly written queries, or abusive usage.
|
||||
|
||||
The timeout values were picked as a reasonable default for the majority of use-cases, but can be modified using the [ALTER ROLE](https://www.postgresql.org/docs/13/sql-alterrole.html) statement:
|
||||
|
||||
```sql
|
||||
alter role authenticated set statement_timeout = '15s';
|
||||
```
|
||||
|
||||
You can also update the statement timeout for a session:
|
||||
|
||||
```sql
|
||||
set statement_timeout to 60000; -- 1 minute in milliseconds
|
||||
```
|
||||
|
||||
## Statement Optimization
|
||||
|
||||
All Supabase projects come with the [pg_stat_statements](https://www.postgresql.org/docs/13/pgstatstatements.html) extension installed, which tracks planning and execution statistics for all statements executed against it. These statistics can be used in order to diagnose the performance of your project.
|
||||
|
||||
This data can further be used in conjunction with the [explain](https://www.postgresql.org/docs/13/using-explain.html) functionality of Postgres to optimize your usage.
|
||||
@@ -30,14 +30,6 @@ info:
|
||||
# items:
|
||||
# - Creating columns
|
||||
# - Column types
|
||||
- name: 'Replication'
|
||||
items:
|
||||
- Publications
|
||||
- name: 'Database Configuration'
|
||||
items:
|
||||
# - Database Users
|
||||
- Database Passwords
|
||||
- Changing Timezones
|
||||
|
||||
pages:
|
||||
Schemas:
|
||||
@@ -156,72 +148,6 @@ pages:
|
||||
# alter table new_table
|
||||
# add new_column text;
|
||||
# ```
|
||||
|
||||
Publications:
|
||||
description: |
|
||||
Publications are a way of grouping changes generated from a table or a group of tables.
|
||||
These changes can then be sent to other systems (usually another Postgres database).
|
||||
|
||||
examples:
|
||||
- name: Create a Publication
|
||||
description: |
|
||||
This publication will contain all changes to all tables.
|
||||
sql: |
|
||||
```sql
|
||||
create publication publication_name
|
||||
for all tables;
|
||||
```
|
||||
- name: Create a Publication which listens to individual tables
|
||||
sql: |
|
||||
```sql
|
||||
create publication publication_name
|
||||
for table table_one, table_two;
|
||||
```
|
||||
- name: Add tables to an existing publication
|
||||
sql: |
|
||||
```sql
|
||||
alter publication publication_name
|
||||
add table table_name;
|
||||
```
|
||||
- name: Listens to inserts only
|
||||
sql: |
|
||||
```sql
|
||||
create publication publication_name
|
||||
for all tables
|
||||
with (publish = 'insert');
|
||||
```
|
||||
- name: Listens to updates only
|
||||
sql: |
|
||||
```sql
|
||||
create publication publication_name
|
||||
for all tables
|
||||
with (publish = 'update');
|
||||
```
|
||||
- name: Listens to deletions only
|
||||
sql: |
|
||||
```sql
|
||||
create publication publication_name
|
||||
for all tables
|
||||
with (publish = 'delete');
|
||||
```
|
||||
- name: Remove a Publication
|
||||
sql: |
|
||||
```sql
|
||||
drop publication if exists publication_name;
|
||||
```
|
||||
- name: Recreate a Publication
|
||||
description: |
|
||||
If you are planning to re-create a publication, it's best to do it in a transaction to ensure the operation succeeds.
|
||||
sql: |
|
||||
```sql
|
||||
begin;
|
||||
-- remove the realtime publication
|
||||
drop publication if exists publication_name;
|
||||
|
||||
-- re-create the publication but don't enable it for any tables
|
||||
create publication publication_name;
|
||||
commit;
|
||||
```
|
||||
|
||||
Database Users:
|
||||
description: |
|
||||
@@ -234,92 +160,3 @@ pages:
|
||||
create user new_user
|
||||
with password 'hello';
|
||||
```
|
||||
Database Passwords:
|
||||
description: |
|
||||
Manage the passwords of your database users using any super user.
|
||||
|
||||
examples:
|
||||
- name: Password reset
|
||||
sql: |
|
||||
```sql
|
||||
alter user postgres
|
||||
with password 'new_password';
|
||||
```
|
||||
Changing Timezones:
|
||||
description: |
|
||||
Data types.
|
||||
notes: |
|
||||
- View a full list of timezones on [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
||||
|
||||
examples:
|
||||
- name: Change timezone
|
||||
isSpotlight: true
|
||||
sql: |
|
||||
```sql
|
||||
alter database postgres
|
||||
set timezone to 'America/New_York';
|
||||
```
|
||||
- name: Full list of timezones
|
||||
description: |
|
||||
Get a full list of timezones supported by your database. This will return the following columns:
|
||||
|
||||
- `name`: Time zone name
|
||||
- `abbrev`: Time zone abbreviation
|
||||
- `utc_offset`: Offset from UTC (positive means east of Greenwich)
|
||||
- `is_dst`: True if currently observing daylight savings
|
||||
|
||||
sql: |
|
||||
```sql
|
||||
select name, abbrev, utc_offset, is_dst
|
||||
from pg_timezone_names()
|
||||
order by name;
|
||||
```
|
||||
- name: Search for a specific timezone
|
||||
description: Use `ilike` (case insensitive search) to find specific timezones.
|
||||
sql: |
|
||||
```sql
|
||||
select *
|
||||
from pg_timezone_names()
|
||||
where name ilike '%york%';
|
||||
```
|
||||
|
||||
Connection Strings:
|
||||
description: |
|
||||
There are various ways to connect to your database, depending on the configuration of your Postgres instance and the tool which you are connecting with.
|
||||
|
||||
notes: |
|
||||
- [Official Documentation](https://www.postgresql.org/docs/current/libpq-connect.html).
|
||||
- Avoid using special characters usernames and passwords. If you use special characters in a connection URL, you'll need to URL encode any special characters.
|
||||
|
||||
examples:
|
||||
- name: Basic connection string
|
||||
description: |
|
||||
If you're using a default setup, your postgres connection string will likely be in the format:
|
||||
|
||||
`postgres://{user}:{password}@{host}:{port}/{database_name}`
|
||||
|
||||
isSpotlight: true
|
||||
sql: |
|
||||
```bash
|
||||
postgres://postgres:postgres@localhost:5432/postgres
|
||||
# or
|
||||
postgresql://postgres:postgres@localhost:5432/postgres
|
||||
```
|
||||
- name: JDBC
|
||||
description: See full [documentation](http://jdbc.postgresql.org/documentation/head/connect.html).
|
||||
sql: |
|
||||
```bash
|
||||
jdbc:postgresql://{host}:{port}/{database_name}
|
||||
```
|
||||
- name: ADO.NET
|
||||
description: See full [documentation](http://npgsql.projects.postgresql.org/docs/manual/UserManual.html).
|
||||
sql: |
|
||||
```bash
|
||||
Server=host;Port=5432;User Id=username;Password=secret;Database=database_name;
|
||||
```
|
||||
- name: PHP
|
||||
description: See full [documentation](http://php.net/manual/en/book.pgsql.php).
|
||||
sql: |
|
||||
```bash
|
||||
host=hostname port=5432 dbname=databasename user=username password=secret
|
||||
```
|
||||
Reference in new issue
Block a user