{"id":15397534,"url":"https://github.com/kgajera/platformatic-prisma","last_synced_at":"2025-04-15T22:31:03.916Z","repository":{"id":63066347,"uuid":"565014077","full_name":"kgajera/platformatic-prisma","owner":"kgajera","description":"Generate migrations for your Platformatic DB using a Prisma schema","archived":false,"fork":false,"pushed_at":"2024-01-26T00:39:41.000Z","size":1162,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T03:04:02.724Z","etag":null,"topics":["platformatic","prisma"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kgajera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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},"funding":{"github":"kgajera"}},"created_at":"2022-11-12T04:12:47.000Z","updated_at":"2025-01-12T21:46:55.000Z","dependencies_parsed_at":"2024-10-19T04:26:00.733Z","dependency_job_id":null,"html_url":"https://github.com/kgajera/platformatic-prisma","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"e75832e7db9f0d2e885c539872d32ce415bbe62d"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgajera%2Fplatformatic-prisma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgajera%2Fplatformatic-prisma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgajera%2Fplatformatic-prisma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kgajera%2Fplatformatic-prisma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kgajera","download_url":"https://codeload.github.com/kgajera/platformatic-prisma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249165958,"owners_count":21223355,"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":["platformatic","prisma"],"created_at":"2024-10-01T15:38:20.043Z","updated_at":"2025-04-15T22:31:03.264Z","avatar_url":"https://github.com/kgajera.png","language":"JavaScript","funding_links":["https://github.com/sponsors/kgajera"],"categories":["JavaScript"],"sub_categories":[],"readme":"# Platformatic Prisma\n\n[![npm version](https://badge.fury.io/js/platformatic-prisma.svg)](https://www.npmjs.com/package/platformatic-prisma)\n\nRemove the friction to create migrations for your [Platformatic DB](https://oss.platformatic.dev/docs/reference/db/introduction) by generating them using a [Prisma schema](https://www.prisma.io/docs/concepts/components/prisma-schema).\n\n- Use Prisma schema to manage your data models\n- Generate Platformatic DB compatible up and down [migrations](https://oss.platformatic.dev/docs/reference/db/migrations) when changes are made to your Prisma schema\n- Migrations will be [run](https://oss.platformatic.dev/docs/reference/db/migrations#how-to-run-migrations) by Platformatic DB\n\nView the [example project](./example) to see it in action.\n\n## Getting Started\n\nInstall `platformatic-prisma` and `prisma`:\n\n```\nnpm install prisma platformatic-prisma -D\n```\n\nCreate a `./prisma/schema.prisma` file with the following contents:\n\n```prisma\ndatasource db {\n  // Any provider supported by Platformatic\n  // https://oss.platformatic.dev/docs/reference/db/introduction#supported-databases\n  provider = \"postgresql\"\n  url      = env(\"DATABASE_URL\")\n}\n\n// Table used by Platformatic/Postgrator to manage migrations\nmodel Version {\n  version BigInt    @id\n  name    String?\n  md5     String?\n  run_at  DateTime? @db.Timestamptz(6)\n\n  @@map(\"versions\")\n  @@ignore\n}\n```\n\nCreate an [`.env` file](https://www.prisma.io/docs/guides/development-environment/environment-variables#using-env-files) containing the database connection URL to connect to your database:\n\n```\nDATABASE_URL=\"postgresql://postgres:@localhost:5432/platformatic-prisma?schema=public\"\n```\n\n## Generating Migrations\n\n\u003e **Note**\n\u003e If you are just starting with a new Platformatic DB project, run `npx platformatic db migrate` before generating your first migration. This is needed to allow Platformatic DB to initialize the database with it's migrations table.\n\nWhen changes are made to your `schema.prisma` file, run `npx platformatic-prisma` to generate migrations. This will generate up and down migration files in the migrations directory that is specified in your Platformatic [configuration file](https://oss.platformatic.dev/docs/reference/db/configuration#configuration-file).\n\nTo run migrations, refer to [Platformatic's documentation](https://oss.platformatic.dev/docs/reference/db/migrations).\n\n### Options\n\n| Option          | Required | Description                                                       | Default                |\n| --------------- | -------- | ----------------------------------------------------------------- | ---------------------- |\n| `--description` | No       | Label to include in migration filename. Must not contain periods. |                        |\n| `--no-down`     | No       | Prevents generation of the down migration file.                   | `false`                |\n| `--no-up`       | No       | Prevents generation of the up migration file.                     | `false`                |\n| `--schema`      | No       | Specifies the path to the `schema.prisma` file.                   | `prisma/schema.prisma` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgajera%2Fplatformatic-prisma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkgajera%2Fplatformatic-prisma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkgajera%2Fplatformatic-prisma/lists"}