Implementing my custom SchemaSource

Open
#203 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
go, postgres
Domain
databases

Research direction

Start by reading the SchemaSource and DBSchemaSource entry points, including GetSchema, and inspect the schemaSourcePlanDeps and Schema types. Determine whether exposing those types and supporting serialization fits the library's public API; done means a custom remote SchemaSource can exchange schemas without temporary databases.

Written by the indexing model from the issue text.

Description

Hi there 👋

Because of our infra setup, I don't have direct access to the databases I want to diff.
That's why I opted for getting pg_dumps of both DBs and using DDLSchemaSource. But I realized this is not a viable option either because I cannot create temporary DBs where my code runs.

So after digging into your code a bit more, I think that the cleanest solution to this would be implementing my own SchemaSource with my custom GetSchema() function that would work something like this for both DBs I want to diff:

  1. Call some API endpoint in the machine where my DB is
  2. The API would connect to the actual DB, wrap it into a DBSchemaSource to call GetSchema()
  3. Serialize the schema and send it back

Having said that, in order to implement my custom SchemaSource, I would need these two things:

  • The type schemaSourcePlanDeps to be public
  • The type Schema to be public so I can serialize it and send it from one place to another. (Even if it changes in the future, serializing and deserializing again should work just fine)

Hopefully I've explained myself clear enough...


So my question is, would it be possible for you to release those changes or what I'm asking goes against something you have in mind with your library?

Thanks in advance!

Dominant language
Go
Stars
884
Forks
82
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stripe/pg-schema-diff

All issues in stripe/pg-schema-diff

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.