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

prisma db pull adds redundant comments: "This table is a partition table ..." #18103

Closed
birgersp opened this issue Feb 26, 2023 · 1 comment · Fixed by prisma/prisma-engines#3877
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: prisma db pull CLI: prisma db pull
Milestone

Comments

@birgersp
Copy link

birgersp commented Feb 26, 2023

Bug description

When doing prisma db pull on a database with a partition table, the schema.prisma gets a comment like this:

/// This table is a partition table and requires additional setup for migrations. Visit https://pris.ly/d/partition-tables for more info.

If you do prisma db pull again, the comment is added again, even though it already existed

How to reproduce

Create a partition table:

drop table if exists "TestTable";
create table "TestTable"(
	"time" timestamptz not null
) partition by range ("time");

create table "TestTable_y2006m02" partition of "TestTable"
    for values from ('2006-02-01') to ('2006-03-01');

Run prisma pull three times (or, at least more than once)

npx prisma pull
npx prisma pull
npx prisma pull

Observe the generated schema.prisma:

generator client1 {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = "postgresql://postgres:ThisIsJustAPrismaDebug@localhost/testdb?schema=public"
}

/// This table is a partition table and requires additional setup for migrations. Visit https://pris.ly/d/partition-tables for more info.
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by the Prisma Client.
/// This table is a partition table and requires additional setup for migrations. Visit https://pris.ly/d/partition-tables for more info.
/// This table is a partition table and requires additional setup for migrations. Visit https://pris.ly/d/partition-tables for more info.
model TestTable {
  time DateTime @db.Timestamptz(6)

  @@ignore
}

Notice how the message This table is a partition table and requires additional setup for migrations. Visit https://pris.ly/d/partition-tables for more info. is repeated once for every time we ran prisma db pull

Expected behavior

The comment should only appear once per model.

Prisma information

(The schema.prisma is already included above)

Prisma version: 4.10.1
Postgres version: 14

Environment & setup

  • OS: Ubuntu 22.04
  • Database: Postgres
  • Node.js version: 16.19.0

Prisma Version

prisma                  : 4.10.1
@prisma/client          : Not found
Current platform        : debian-openssl-3.0.x
Query Engine (Node-API) : libquery-engine aead147aa326ccb985dcfed5b065b4fdabd44b19 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
Migration Engine        : migration-engine-cli aead147aa326ccb985dcfed5b065b4fdabd44b19 (at node_modules/@prisma/engines/migration-engine-debian-openssl-3.0.x)
Format Wasm             : @prisma/prisma-fmt-wasm 4.10.1-1.80b351cc7c06d352abe81be19b8a89e9c6b7c110
Default Engines Hash    : aead147aa326ccb985dcfed5b065b4fdabd44b19
Studio                  : 0.481.0
@birgersp birgersp added the kind/bug A reported bug. label Feb 26, 2023
@janpio janpio added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. team/schema Issue for team Schema. topic: prisma db pull CLI: prisma db pull process/candidate labels Feb 26, 2023
@eviefp eviefp self-assigned this Apr 6, 2023
@eviefp eviefp added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Apr 6, 2023
@eviefp
Copy link
Contributor

eviefp commented Apr 6, 2023

I validated this and it indeed reproduces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. team/schema Issue for team Schema. topic: prisma db pull CLI: prisma db pull
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants