docs: improve database migrations guide (#30914)

This commit is contained in:
Han Qiao authored and GitHub committed 2024-12-05 23:43:43 +08:00
1 parent 731a23d3a9
commit 67e12df620
6 files changed
+130 -73

No files matched your search

@@ -0,0 +1,4 @@
# Supabase
.branches
.temp
.env
@@ -0,0 +1,21 @@
# For detailed configuration reference documentation, visit:
# https://supabase.com/docs/guides/local-development/cli/config
# A string used to distinguish different Supabase projects on the same host. Defaults to the
# working directory name when running `supabase init`.
project_id = "employees"
[db]
# Port to use for the local database URL.
port = 54322
# Port used by db diff command to initialize the shadow database.
shadow_port = 54320
# The database major version to use. This has to be the same as your remote database's. Run `SHOW
# server_version;` on the remote database to check.
major_version = 15
[db.seed]
# If enabled, seeds the database after migrations during a db reset.
enabled = true
# Specifies an ordered list of seed files to load during db reset.
# Supports glob patterns relative to supabase directory: `./seeds/*.sql'
sql_paths = ['./seed.sql']
@@ -0,0 +1,6 @@
create table if not exists employees (
id bigint primary key generated always as identity,
name text not null,
email text,
created_at timestamptz default now()
);
@@ -0,0 +1,2 @@
alter table if exists public.employees
add department text default 'Hooli';
@@ -0,0 +1,6 @@
insert into public.employees
(name)
values
('Erlich Bachman'),
('Richard Hendricks'),
('Monica Hall');