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: sykle/plugins/sync_pg_data/README.md
+18-8Lines changed: 18 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,19 @@
2
2
3
3
Wrapper around `pg_restore`, `pg_dump` and `psql` that allows you to sync data from one location to another.
4
4
5
-
### Data only
5
+
### Usage Instructions
6
6
7
-
This command does NOT do a full database dump and restore. Dumps and restores DATA ONLY so we can sync apps that still have active connections. This means all tables in the source that you would like to link to the destination must be present.
7
+
This command will sync BOTH data and the schema. This has a couple implications:
8
8
9
-
### Truncation
10
-
11
-
In order to avoid foreign key constraint errors when restoring data, any existing data must be removed. This means *THE ORIGINAL DESTINATION DATA WILL BE REMOVED*.
9
+
- You will need to ensure that the place you are syncing FROM has code that is either the SAME or is OLDER than the place you are syncing to. Although you **COULD** dump data from a newer codebase into data from an older codebase, if the database schema has changed, the code and migrations will not work properly.
10
+
-`production -> staging` ✅
11
+
-`staging -> development` ✅
12
+
-`production -> development` ✅
13
+
-~~`staging -> production`~~ ❌
14
+
-~~`development -> staging`~~ ❌
15
+
-~~`development -> production`~~ ❌
16
+
- Any services using the destination database will need to be stopped. You can use the `dependent_services` section of the config to list docker-compose services that should automatically be stopped and restarted.
17
+
- Syncing will DELETE all data in the destination database and replace it with data from the source. You can make a backup before syncing using the `dump` command
12
18
13
19
### Why put this in syk?
14
20
@@ -37,7 +43,7 @@ Usage instructions can be viewed after installation with `sykle sync_pg_data --h
Copy file name to clipboardExpand all lines: sykle/plugins/sync_pg_data/README.mustache
+13-7Lines changed: 13 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,19 @@
2
2
3
3
Wrapper around `pg_restore`, `pg_dump` and `psql` that allows you to sync data from one location to another.
4
4
5
-
### Data only
6
-
7
-
This command does NOT do a full database dump and restore. Dumps and restores DATA ONLY so we can sync apps that still have active connections. This means all tables in the source that you would like to link to the destination must be present.
8
-
9
-
### Truncation
10
-
11
-
In order to avoid foreign key constraint errors when restoring data, any existing data must be removed. This means *THE ORIGINAL DESTINATION DATA WILL BE REMOVED*.
5
+
### Usage Instructions
6
+
7
+
This command will sync BOTH data and the schema. This has a couple implications:
8
+
9
+
- You will need to ensure that the place you are syncing FROM has code that is either the SAME or is OLDER than the place you are syncing to. Although you **COULD** dump data from a newer codebase into data from an older codebase, if the database schema has changed, the code and migrations will not work properly.
10
+
- `production -> staging` ✅
11
+
- `staging -> development` ✅
12
+
- `production -> development` ✅
13
+
- ~~`staging -> production`~~ ❌
14
+
- ~~`development -> staging`~~ ❌
15
+
- ~~`development -> production`~~ ❌
16
+
- Any services using the destination database will need to be stopped. You can use the `dependent_services` section of the config to list docker-compose services that should automatically be stopped and restarted.
17
+
- Syncing will DELETE all data in the destination database and replace it with data from the source. You can make a backup before syncing using the `dump` command
0 commit comments