Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/starnowski/posmulten-dump
https://github.com/starnowski/posmulten-dump
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/starnowski/posmulten-dump
- Owner: starnowski
- License: lgpl-2.1
- Created: 2023-07-24T07:37:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-09T22:13:28.000Z (about 1 year ago)
- Last Synced: 2024-10-11T08:14:34.661Z (28 days ago)
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# posmulten-dump
Suggestion:
1. Reserve index that will be added to name of tables that are going to be exported.
Index is assigned to specific tenant which is going to be exorted.Before creating tables, restrict any write access for tenant that is suppose to migrated with proper RLS policy
2. Create table that suppose to be exported
```sudocode
forearch (table : tablesToExport) {CREATE TABLE export_tab_{index}_{table}
SELECT * FROM {table}
}
```
3. Export data (in one or multiple files) with pg_dump4. Create sql script for assertion that checks total amount of records for all tables
IMPORT
5. Chec sequnce values in exported database
- Check what is the highest (current value) in sequence
- Alternative, if configuration has information which table and column use specific sequence then based on "export_tab" the value of sequnece that might be required to update can be calculated based on export tables and not current value of sequence which can be higher
6. Update sequences in target database
7. Import data from files to target database (all constraint for operation has to be turned off)
AFTER IMPORT
Execute potential script and pass tenant id as argument
8 Delete tables for {index} like export_tab_{index}_{table}