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

Unable to specify PostgreSQL schema when calling schema.alterTable #470

Closed
hannesj opened this issue May 9, 2023 · 2 comments · Fixed by #471
Closed

Unable to specify PostgreSQL schema when calling schema.alterTable #470

hannesj opened this issue May 9, 2023 · 2 comments · Fixed by #471
Labels
bug Something isn't working postgres Related to PostgreSQL

Comments

@hannesj
Copy link
Contributor

hannesj commented May 9, 2023

When calling db.schema.alterTable, it is not possible to give it a table name with a postgres schema name. This is possible in db.schema.createTable and db.schema.dropTable, as they call parseTable, when creating the node, which returns the table identifier separated in schema and table names

typescript:

db.schema
    .alterTable("schema.table")
    .addColumn("started_at", "timestamptz")
    .execute()

sql:

alter table "schema.table" add column "started_at" timestamptz

sql should be:

alter table "schema"."table" add column "started_at" timestamptz
@koskimas
Copy link
Member

koskimas commented May 9, 2023

Hey, thanks for reporting this! We'll fix this ASAP. In the meantime, you should be able to do this:

db.schema
    .withSchema("schema")
    .alterTable("table")
    .addColumn("started_at", "timestamptz")
    .execute()

@koskimas koskimas added the bug Something isn't working label May 9, 2023
@hannesj
Copy link
Contributor Author

hannesj commented May 9, 2023

Hi, took a stab in fixing it in #471

@igalklebanov igalklebanov added the postgres Related to PostgreSQL label May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working postgres Related to PostgreSQL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants