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

test(client): multiSchema, test same table name #15647

Merged
merged 6 commits into from Nov 23, 2022

Conversation

Jolg42
Copy link
Member

@Jolg42 Jolg42 commented Oct 4, 2022

Closes #15009

We previously tested different table names because of a bug in validation, this PR changes that to test the same table name but in 2 different db schemas.

@Jolg42 Jolg42 added this to the 4.5.0 milestone Oct 4, 2022
@Jolg42 Jolg42 requested review from danstarns and a team October 4, 2022 08:24
Copy link
Contributor

@danstarns danstarns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I assume we are waiting on an engine's version for this to pass. Happy to merge once its green.

@Jolg42
Copy link
Member Author

Jolg42 commented Oct 4, 2022

Waiting for #15649 for engines

@Jolg42 Jolg42 force-pushed the joel/multiSchema-same-table-name branch from 02763dc to 085b2c1 Compare October 5, 2022 12:38
@Jolg42
Copy link
Member Author

Jolg42 commented Oct 5, 2022

Currently fails with
https://github.com/prisma/prisma/actions/runs/3189841431/jobs/5204140972#step:10:2842

FAIL tests/functional/multi-schema/tests.ts (14.334 s)
  ● multi-schema (provider=postgresql, mapTable=true) › create

    Schema validation error - Error (query-engine-node-api library)
    Error code: P1012
    error: Error parsing attribute "@id": The given constraint name `some_table_pkey` has to be unique in the following namespace: global for primary key, indexes and unique constraints. Please provide a different name using the `map` argument.
      -->  schema.prisma:14
       | 
    13 |     model User {
    14 |       id String @id @default(cuid())
       | 
    error: Error parsing attribute "@id": The given constraint name `some_table_pkey` has to be unique in the following namespace: global for primary key, indexes and unique constraints. Please provide a different name using the `map` argument.
      -->  schema.prisma:23
       | 
    22 |     model Post {
    23 |       id String @id @default(cuid())
       | 

    Validation Error Count: 2
    [Context: getDmmf]

@Jolg42 Jolg42 force-pushed the joel/multiSchema-same-table-name branch from 085b2c1 to 0bfea15 Compare October 11, 2022 15:08
@Jolg42
Copy link
Member Author

Jolg42 commented Oct 11, 2022

New engines from prisma/prisma-engines#3269 are now showing a different error.

https://github.com/prisma/prisma/actions/runs/3228011532/jobs/5283599499#step:10:4693

       db error: ERROR: relation "some_table" already exists
      0: sql_migration_connector::apply_migration::migration_step
                 with step=CreateTable { table_id: TableId(1) }
                   at migration-engine/connectors/sql-migration-connector/src/apply_migration.rs:21
      1: sql_migration_connector::apply_migration::apply_migration
                   at migration-engine/connectors/sql-migration-connector/src/apply_migration.rs:10
      2: migration_core::state::SchemaPush
                   at migration-engine/core/src/state.rs:380
      Error: db error: ERROR: relation "some_table" already exists
      0: sql_migration_connector::apply_migration::migration_step
                 with step=CreateTable { table_id: TableId(1) }
                   at migration-engine/connectors/sql-migration-connector/src/apply_migration.rs:21
      1: sql_migration_connector::apply_migration::apply_migration
                   at migration-engine/connectors/sql-migration-connector/src/apply_migration.rs:10
      2: migration_core::state::SchemaPush
                   at migration-engine/core/src/state.rs:380

@tomhoule it seems something is missing for SchemaPush

@Jolg42
Copy link
Member Author

Jolg42 commented Oct 11, 2022

The error is expected because multi schema migrations are not yet implemented

@Jolg42 Jolg42 force-pushed the joel/multiSchema-same-table-name branch from 0bfea15 to f70e4a4 Compare October 14, 2022 12:36
Jolg42 added a commit that referenced this pull request Oct 14, 2022
…gration

Closes #15009

Similar as #15647 but using a SQL migration as Migrate support for multi-schema is not here yet
Jolg42 added a commit that referenced this pull request Oct 14, 2022
…gration

Closes #15009

Similar as #15647 but using a SQL migration as Migrate support for multi-schema is not here yet
@Jolg42 Jolg42 force-pushed the joel/multiSchema-same-table-name branch from 4127277 to abd5786 Compare October 14, 2022 13:25
@Jolg42
Copy link
Member Author

Jolg42 commented Oct 14, 2022

Since Migrate support is needed to do this test in the functional test suite, I did it in the old integration tests #15798

@Jolg42 Jolg42 marked this pull request as draft October 14, 2022 13:26
@janpio janpio modified the milestones: 4.5.0, 4.6.0 Oct 18, 2022
Jolg42 added a commit that referenced this pull request Oct 25, 2022
…gration

Closes #15009

Similar as #15647 but using a SQL migration as Migrate support for multi-schema is not here yet
@Jolg42 Jolg42 force-pushed the joel/multiSchema-same-table-name branch from abd5786 to e1698eb Compare October 25, 2022 15:20
Jolg42 added a commit that referenced this pull request Nov 7, 2022
…gration

Closes #15009

Similar as #15647 but using a SQL migration as Migrate support for multi-schema is not here yet
@janpio janpio modified the milestones: 4.6.0, 4.7.0 Nov 8, 2022
Jolg42 added a commit that referenced this pull request Nov 9, 2022
…gration

Closes #15009

Similar as #15647 but using a SQL migration as Migrate support for multi-schema is not here yet
@Jolg42 Jolg42 marked this pull request as ready for review November 23, 2022 16:00
@Jolg42 Jolg42 merged commit 0c6315a into main Nov 23, 2022
@Jolg42 Jolg42 deleted the joel/multiSchema-same-table-name branch November 23, 2022 16:02
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

Successfully merging this pull request may close these issues.

[Multi Schema] Same model map different schema
3 participants