-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
c/communityRelated to community contentRelated to community contentk/ideasDiscuss new ideas / pre-proposals / roadmapDiscuss new ideas / pre-proposals / roadmap
Description
I'm creating this bash to dump data and schema. If useful we can add such a small and handy tools or bash in community content folder in this repo.
#!/bin/bash
docker ps
echo -e "Hi, please enter postgres container id for dump schemas: \c "
read postgres_container_id
echo -e "Please enter postgres database name: [for example: postgres] \c "
read database_name
mkdir -p data_dump
cd data_dump
while :
do
echo -e "Press <CTRL+C> to exit or Enter schema name for dump: \c "
read schema_name
mkdir -p schema
cd schema
docker exec $postgres_container_id pg_dump -O -x -U $database_name --schema-only --schema $schema_name > ./$schema_name.sql
mkdir -p clean
curl --data-binary @./$schema_name.sql https://hasura-edit-pg-dump.now.sh > ./clean/$schema_name.sql
cd ..
mkdir -p data
cd data
docker exec $postgres_container_id pg_dump -O -x -U $database_name --data-only --schema $schema_name > ./$schema_name.sql
mkdir -p clean
curl --data-binary @./$schema_name.sql https://hasura-edit-pg-dump.now.sh > ./clean/$schema_name.sql
cd ..
mkdir -p schema_with_data
cd schema_with_data
docker exec $postgres_container_id pg_dump -O -x -U $database_name --schema $schema_name > ./$schema_name.sql
mkdir -p clean
curl --data-binary @./$schema_name.sql https://hasura-edit-pg-dump.now.sh > ./clean/$schema_name.sql
cd ..
done
What is your opinion?
@shahidhk Some handy tools like your stream about migration. 😉
Metadata
Metadata
Assignees
Labels
c/communityRelated to community contentRelated to community contentk/ideasDiscuss new ideas / pre-proposals / roadmapDiscuss new ideas / pre-proposals / roadmap