{"id":21997569,"url":"https://github.com/stephane-klein/docker-compose-postgres-helper","last_synced_at":"2026-04-18T06:07:01.776Z","repository":{"id":99039654,"uuid":"199270075","full_name":"stephane-klein/docker-compose-postgres-helper","owner":"stephane-klein","description":"Docker-compose postgres helper scripts","archived":false,"fork":false,"pushed_at":"2023-05-30T17:24:12.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T11:31:15.470Z","etag":null,"topics":["docker-compose","fixtures","postgres","scaffolding"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephane-klein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-28T09:56:57.000Z","updated_at":"2022-07-24T11:45:59.000Z","dependencies_parsed_at":"2025-01-28T11:41:28.534Z","dependency_job_id":null,"html_url":"https://github.com/stephane-klein/docker-compose-postgres-helper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fdocker-compose-postgres-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fdocker-compose-postgres-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fdocker-compose-postgres-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephane-klein%2Fdocker-compose-postgres-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephane-klein","download_url":"https://codeload.github.com/stephane-klein/docker-compose-postgres-helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056902,"owners_count":20553854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","fixtures","postgres","scaffolding"],"created_at":"2024-11-29T22:17:11.125Z","updated_at":"2026-04-18T06:07:01.741Z","avatar_url":"https://github.com/stephane-klein.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-compose postgres helper scripts\n\nFeatures:\n\n- [x] Start and wait Postgres\n- [x] Load seed schema\n- [x] Load fixtures\n- [x] Enter in PostgreSQL interactive terminal\n- [x] Dump local database\n- [x] Import in local database\n\n## How to use\n\n```sh\n$ docker compose version\nDocker Compose version 2.2.2\n```\n\nStart Postgres and wait it starting:\n\n```\n$ docker compose up -d postgres --wait\n```\n\nInitialize database with seed schema:\n\n```\n$ ./scripts/seed.sh\n\"Database cleaning...\"\n\"Database cleaned\"\n\"Schema creating...\"\n\"Schema created\"\n```\n\nLoad fixtures:\n\n```\n$ ./scripts/fixtures.sh\n\"Cleaning tables...\"\n\"Tables cleaned\"\n\"Loading users fixtures...\"\n\"Users fixtures loaded\"\n```\n\nEnter in Postgres PostgreSQL interactive terminal:\n\n```\n$ ./scripts/enter-in-pg.sh\npsql (11.4)\nType \"help\" for help.\n\npostgres=# \\d\n         List of relations\n Schema | Name  | Type  |  Owner\n--------+-------+-------+----------\n public | users | table | postgres\n(1 row)\n\npostgres=# select * from users limit 2;\n                  id                  |  username   |          email           |                        password_hash                         |          created_at          |          updated_at\n--------------------------------------+-------------+--------------------------+--------------------------------------------------------------+------------------------------+------------------------------\n 1de9c987-08ab-32fe-e218-89c124cd0001 | username001 | username 001@example.com | $2a$11$27s.UnSqrdSGwYSmacQzcOzjgZJFsmAQRY6OhcHTEWA4pmRFxYEWy | 2019-07-28 09:54:38.73218+00 | 2019-07-28 09:54:38.73218+00\n 1de9c987-08ab-32fe-e218-89c124cd0002 | username002 | username 002@example.com | $2a$11$27s.UnSqrdSGwYSmacQzcOzjgZJFsmAQRY6OhcHTEWA4pmRFxYEWy | 2019-07-28 09:54:38.73218+00 | 2019-07-28 09:54:38.73218+00\n(2 rows)\n```\n\nGenerate local dump:\n\n```\n$ ./scripts/dump-local-pg.sh\nDump exported in dumps/dump.sql\n```\n\nImport dump locally:\n\n```\n$ ./scripts/import-in-local-pg.sh\n```\n\nDisplay table size:\n\n```\n$ ./scripts/display-table-sizes.sh | grep \"users\"\n public.users                                             | 48 kB      | 32 kB        | 80 kB\n```\n\nHow to execute multiline SQL command:\n\n```\n$ cat \u003c\u003c EOF | docker compose exec -T postgres sh -c \"psql --quiet -U \\$POSTGRES_USER \\$POSTGRES_DB\"\nCREATE OR REPLACE FUNCTION drop_all ()\n   RETURNS VOID  AS\n   \\$\\$\n   DECLARE rec RECORD;\n   BEGIN\n       -- Get all the schemas\n        FOR rec IN\n        SELECT nspname FROM pg_catalog.pg_namespace WHERE (nspname NOT LIKE 'pg_%') and (nspname != 'information_schema')\n           LOOP\n             EXECUTE 'DROP SCHEMA ' || rec.nspname || ' CASCADE';\n           END LOOP;\n           RETURN;\n   END;\n   \\$\\$ LANGUAGE plpgsql;\n\nSELECT drop_all();\nEOF\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephane-klein%2Fdocker-compose-postgres-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephane-klein%2Fdocker-compose-postgres-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephane-klein%2Fdocker-compose-postgres-helper/lists"}