Skip to content

Handle TimescaleDB error message when trying to create shadow database #20266

Closed

Description

@janpio

TimescaleDB seems to return a special error message when migrate dev tries to create a shadow database, which we do not handle yet and hence just dump at the user without special handling.

via #8325 (comment)

Try to run the npx prisma migrate dev command on the timescale forge database will result in an error since the command tries to create a table:

Error: Database error
Error querying the database: db error: ERROR: tsdb_admin: database prisma_migrate_shadow_db_ab8fe7fa-8d81-4493-bafe-bf5645e6d2cc is not an allowed database name
HINT: Contact your administrator to configure the "tsdb_admin.allowed_databases"

Following the suggestions in #4571 and here: prisma.io/docs/concepts/components/prisma-migrate#shadow-database the guess would be that it is not possible to use the timescale forge service for the shadow db.

We could detect this error message and handle it with a link to the "shadow database when you can not CREATE DATABASE" documentation as we do with other cases we detect.

Activity

  1. janpio commented on Jul 17, 2023

    @janpio
    ContributorAuthor

    Actually, this is already handled appropriately now:

    $ npx prisma migrate dev
    Environment variables loaded from .env
    Prisma schema loaded from prisma/schema.prisma
    Datasource "db": PostgreSQL database "tsdb", schema "public" at "opj14wxfkv.kn5o1onhbq.tsdb.cloud.timescale.com:30943"
    
    Error: P3014
    
    Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at https://pris.ly/d/migrate-shadow
    
    Original error: 
    db error: ERROR: tsdb_admin: database prisma_migrate_shadow_db_1dc9385e-8a23-4b7d-8f30-1c037906c5ef is not an allowed database name
    HINT: Contact your administrator to configure the "tsdb_admin.allowed_databases"
       0: schema_core::state::DevDiagnostic
                 at schema-engine/core/src/state.rs:266
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions