{"id":18620247,"url":"https://github.com/mihailtd/database-migrations-and-testing","last_synced_at":"2025-05-07T08:14:23.717Z","repository":{"id":225181114,"uuid":"756580937","full_name":"mihailtd/database-migrations-and-testing","owner":"mihailtd","description":"Database Migrations and Testing with Bun, PostgreSQL, and Graphile Migrate","archived":false,"fork":false,"pushed_at":"2024-02-29T16:33:59.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T08:14:14.260Z","etag":null,"topics":["database","migration","postgresql"],"latest_commit_sha":null,"homepage":"https://youtu.be/vf7hDdYJQoA","language":"PLpgSQL","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/mihailtd.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}},"created_at":"2024-02-12T22:11:13.000Z","updated_at":"2024-10-22T06:47:03.000Z","dependencies_parsed_at":"2024-02-29T17:53:20.052Z","dependency_job_id":null,"html_url":"https://github.com/mihailtd/database-migrations-and-testing","commit_stats":null,"previous_names":["mihailtd/database-migrations-and-testing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihailtd%2Fdatabase-migrations-and-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihailtd%2Fdatabase-migrations-and-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihailtd%2Fdatabase-migrations-and-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihailtd%2Fdatabase-migrations-and-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mihailtd","download_url":"https://codeload.github.com/mihailtd/database-migrations-and-testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252839296,"owners_count":21812089,"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":["database","migration","postgresql"],"created_at":"2024-11-07T04:05:31.060Z","updated_at":"2025-05-07T08:14:23.613Z","avatar_url":"https://github.com/mihailtd.png","language":"PLpgSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# database-migrations-and-testing\n\nThis repo is a companion to the YouTube video: [Database Migrations and Testing Video](https://youtu.be/vf7hDdYJQoA), and it is a simple project to demonstrate how to use database migrations and testing in a NodeJS / Bun project.\n\nI am using graphile-migrate for database migrations which is a tool that allows you to manage your PostgreSQL database schema using a simple version-controlled workflow.\n\nMake sure to have a PostgreSQL database running.\nIn my case, I am using Crunchy Data's PostgreSQL Operator for Kubernetes, so the `demo-postgres.yaml` file is a Kubernetes manifest to deploy a PostgreSQL database. Note that this requires additional setup and is not required to run the project.\n\nYou just need to run a PostgreSQL database, and have a couple of users and databases created. You don't need to run it on Kubernetes.\n\nYou need toe following databases:\n* demo -\u003e this is the main database\n* demo_shadow -\u003e this is used by graphile-migrate to store the migration history and other metadata about the migrations.\n\nAs for database users:\n* postgres -\u003e this is the superuser, and it is used to be able to run the migrations in watch mode during **DEVELOPMENT**.\n* demo_user -\u003e this is the user that the application will use to connect to the database and run the actual migrations. This user should have access to both the `demo` and `demo_shadow` databases.\n\nTo install dependencies:\n\n```bash\nbun install\n```\n\nTo run:\n\n```bash\nbun run gm --watch\n```\n\nThis project was created using `bun init` in bun v1.0.26. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihailtd%2Fdatabase-migrations-and-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmihailtd%2Fdatabase-migrations-and-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihailtd%2Fdatabase-migrations-and-testing/lists"}