Files
supabase/web/spec/postgres.yml
T

130 lines
3.0 KiB
YAML

openref: 0.1
info:
id: reference/postgres
title: Getting started
description: |
PostgreSQL, also known as Postgres, is a free and open-source relational
database management system emphasizing extensibility and SQL compliance.
It was originally named POSTGRES, referring to its origins as a successor
to the Ingres database developed at the University of California, Berkeley.
definition: spec/combined.json
libraries:
- name: 'SQL'
id: 'sql'
version: '0.0.1'
docs:
path: reference/postgres/
sidebar:
- name: 'About'
items:
- index
- name: 'Database'
items:
# - Database Users
- Database Passwords
# - name: 'Schemas'
# items:
# - Creating schemas
- name: 'Tables'
items:
- Creating tables
# - name: 'Columns'
# items:
# - Creating columns
# - Column types
pages:
Database Users:
description: |
Users and Roles are almost interchangable.
examples:
- name: Create New User
sql: |
```sql
create user prisma
with password 'hello';
```
Database Passwords:
description: |
You can manage the passwords of your database users using any super user.
examples:
- name: Password reset
sql: |
```sql
alter user postgres
with password 'new_password';
```
Creating schemas:
description: |
Creating schemas.
examples:
- name: Create schema
sql: |
```sql
create schema new_schema;
```
Creating tables:
description: |
A relational database consists of multiple related tables. A table consists of rows and columns.
examples:
- name: Create table
isSpotlight: true
sql: |
```sql
create table table_name (
id integer primary key,
data jsonb,
name text
);
```
- name: Primary keys using multiple columns
sql: |
```sql
create table table_name (
column_1 data_type,
column_2 data_type
-- Constraints:
primary key (column_1, column_2)
);
```
Creating columns:
description: |
Creating columns.
examples:
- name: During table creation
isSpotlight: true
sql: |
```sql
create table table_name (
id integer primary key,
data jsonb,
name text
);
```
- name: Create column
sql: |
```sql
alter table new_table
add new_column text;
```
# Data types:
# description: |
# Data types.
# examples:
# - name: Create columns and data types
# sql: |
# ```sql
# alter table new_table
# add new_column text;
# ```