Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating initial TypeScript migration file based on existing schema. #1268

Open
ayazemregm opened this issue Sep 8, 2024 · 4 comments
Open

Comments

@ayazemregm
Copy link

I took a quick look to docs but I could not find how to do schema diff. If I want to integrate this to already existing dbs do I need to write everything again or am I missing something?

@Shinigami92
Copy link
Collaborator

You talking about something like #275?

@ayazemre
Copy link

ayazemre commented Sep 10, 2024

Yes but for typescript generations, not sql if possible. Also I am having hard time to use CLI.

{
    "db": {
        "url": "postgres://postgres:123456@localhost:3002/postgres"
    },
    "schema": "public",
    "createSchema": false,
    "migrationsDir": "migrations",
    "migrationsSchema": "public",
    "createMigrationsSchema": false,
    "migrationsTable": "pgmigrations",
    "migrationFilenameFormat": "utc",
    "migrationFileLanguage": "js",
    "checkOrder": true,
    "verbose": true,
    "decamelize": false,
    "tsconfig": "tsconfig.json"
}

This is my test config

I run npx node-pg-migrate -f ./pgm-config.json up and it tries to connect 5432 not 3002. Also it does not reference migration paths as well. When I change file name it gives error meaning it reads the file just does not apply the settings. I am probably missing something too obvious but wanted to ask here.

@Shinigami92
Copy link
Collaborator

Please open dedicated issues for each separate issue you have, so I can better prioritize them and they don't get lost.

@Shinigami92
Copy link
Collaborator

You should adjust the title to e.g. Generating initial TypeScript migration file based on existing schema.

However, I think this will be a really huge task if not even impossible (because of hundreds of edge-cases)
But feel free to try a PR 🤷

@ayazemregm ayazemregm changed the title Generating migrations based on schema diff Generating initial TypeScript migration file based on existing schema. Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants