Skip to content

Tearing down MSSQL schema returns "Cannot read property 'split' of null" #4635

@matthewmueller

Description

@matthewmueller

Bug description

Unable to migrate.

Environment variables loaded from prisma/.env
Prisma schema loaded from prisma/schema.prisma
Datasource "ms"


Error: Cannot read property 'split' of null

How to reproduce

Currently Prisma schema from introspecting an MSSQL database:

generator js {
  provider        = "prisma-client-js"
  previewFeatures = ["microsoftSqlServer", "nativeTypes"]
}

datasource ms {
  provider = "sqlserver"
  url      = env("DATABASE_URL")
}

model User {
  id   BigInt  @id @default(autoincrement()) @ms.BigInt
  name String? @ms.VarChar(255)
  Post Post[]
}

model Post {
  id        BigInt @id @default(autoincrement()) @ms.BigInt
  title     String @ms.VarChar(100)
  views     BigInt @default(0) @ms.BigInt
  wordCount Int    @default(0) @ms.SmallInt
  user_id   BigInt @ms.BigInt
  User      User   @relation(fields: [user_id], references: [id])
}

model Settings {
  id    Int    @id @default(autoincrement())
  title String
}

Since we don't support native types yet, I adjusted it to this:

generator js {
  provider        = "prisma-client-js"
  previewFeatures = ["microsoftSqlServer"]
}

datasource ms {
  provider = "sqlserver"
  url      = env("DATABASE_URL")
}

// model User {
//   id   BigInt  @id @default(autoincrement()) @ms.BigInt
//   name String? @ms.VarChar(255)
//   Post Post[]
// }

// model Post {
//   id        BigInt @id @default(autoincrement()) @ms.BigInt
//   title     String @ms.VarChar(100)
//   views     BigInt @default(0) @ms.BigInt
//   wordCount Int    @default(0) @ms.SmallInt
//   user_id   BigInt @ms.BigInt
//   User      User   @relation(fields: [user_id], references: [id])
// }

// model Settings {
//   id    Int    @id @default(autoincrement())
//   title String
// }

Then ran:

npx prisma migrate dev --preview-feature

Resulting in:

Environment variables loaded from prisma/.env
Prisma schema loaded from prisma/schema.prisma
Datasource "ms"


Error: Cannot read property 'split' of null

Expected behavior

It should have cleared out my database.

Environment & setup

  • OS:
  • Database:
  • Node.js version:
  • Prisma version:
@prisma/cli          : 2.13.0-dev.99
@prisma/client       : 2.12.0-dev.55
Current platform     : darwin
Query Engine         : query-engine 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt 833ab05d2a20e822f6736a39a27de4fc8f6b3e49 (at node_modules/@prisma/engines/prisma-fmt-darwin)
Studio               : 0.329.0
Preview Features     : microsoftSqlServer

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions