Migrate: Fail when using the default mysql database

Created on 12 May 2020  路  2Comments  路  Source: prisma/migrate

Bug description

The default MySQL database is mysql and contains all the system tables. Users should not use this table for their data. We should at least warn, or even better, forbid to use that table. Also, it prints warnings about those system tables when running prisma migrate.

How to reproduce

docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=pw -d mysql:5.6
yarn prisma migrate save --create-db --name "init" --experimental
yarn prisma migrate up --experimental

Expected behavior

Should fail with an error that you're not supposed to use the system database.

Prisma information

datasource db {
    provider = "mysql"
    url      = "mysql://root:pw@localhost:3306"
    // or
    url      = "mysql://root:pw@localhost:3306/mysql"
}

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

model User {
    id       String  @id @default(cuid())
    email    String  @unique
    username String
    name     String?
}

Environment & setup

  • OS: [e.g. Mac OS, Windows, Debian, CentOS, ...] macOS Catalina
  • Database: [PostgreSQL, MySQL, MariaDB or SQLite] MySQL
  • Prisma version: [Run prisma -v to see your Prisma version] 2.0.0-beta.5
  • Node.js version: [Run node -v to see your Node.js version] v10.16.3
bu2-confirmed kinbug

Most helpful comment

What I think makes sense:

  • Hard error in the migration engine. We probably can't migrate system tables, and if we can we don't want to.
  • Warning in the query engine/introspection engine/quaint

All 2 comments

What I think makes sense:

  • Hard error in the migration engine. We probably can't migrate system tables, and if we can we don't want to.
  • Warning in the query engine/introspection engine/quaint

To my knowledge, this is already implemented. I think this issue can be closed.

Was this page helpful?
0 / 5 - 0 ratings