You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+32-64Lines changed: 32 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,82 +4,50 @@ This repository demonstrates how to use [pgschema](https://www.pgschema.com/) wi
4
4
5
5
## Overview
6
6
7
-
This repository contains two workflows:
8
-
1.**Single File Workflow** - For projects with all schema definitions in one file
9
-
2.**Multi File Workflow** - For projects with schema split across multiple SQL files
7
+
### Plan Workflows (Pull Requests)
8
+
9
+
-**Single File Plan** - Shows migration plan for single-file schemas
10
+
-**Multi File Plan** - Shows migration plan for multi-file schemas
11
+
12
+
Plan workflows automatically:
10
13
11
-
Both workflows automatically:
12
14
- Run `pgschema plan` when a PR modifies schema files
13
15
- Post the migration plan as a comment on the PR
14
16
- Update the comment if the PR is synchronized with new changes
15
17
18
+
### Apply Workflows (Main Branch)
19
+
20
+
-**Single File Apply** - Applies schema changes for single-file approach
21
+
-**Multi File Apply** - Applies schema changes for multi-file approach
22
+
23
+
Apply workflows automatically:
24
+
25
+
- Run `pgschema apply` when changes are pushed to main branch
26
+
- Use `--auto-approve` flag for automated deployment
27
+
- Apply changes to a test PostgreSQL 17 container
28
+
- Report success or failure with detailed logs
29
+
16
30
## Setup
17
31
18
-
### 1. GitHub Secrets
32
+
### GitHub Secrets
19
33
20
-
No secrets required! Both workflows use a PostgreSQL 17 test container for demonstration purposes, making them fully self-contained.
34
+
No secrets required! Both workflows start a PostgreSQL 17 test container for demonstration purposes, making them fully self-contained.
21
35
22
-
### 2. Schema Organization
36
+
### Schema Organization
23
37
24
38
#### Single File Approach
25
-
- Place your complete schema in `singlefile/schema.sql`
39
+
40
+
- Place your complete schema in `singlefile/schema.sql`. This is generated by `pgschema dump --host localhost --user postgres --password testpwd1 --db employee --file schema.sql`.
26
41
- All tables, indexes, functions, and triggers in one file
27
-
- Uses PostgreSQL 17 test container (no external database needed)
28
-
- Compares current branch schema against main branch schema
- Place SQL files in the `multifile/` directory. This is generated by `pgschema dump --host localhost --user postgres --password testpwd1 --db employee --multi-file --file main.sql`
33
48
- Uses `main.sql` as the entry point with psql `\i` directives
34
-
- Organize files by type in subdirectories (tables/, functions/, views/, etc.)
35
-
- Each file contains a specific database object
36
-
- Uses PostgreSQL 17 test container (no external database needed)
37
-
- Compares current branch schema against main branch schema
0 commit comments