Skip to content

Support type keyword for mongodb #131

@ismoiliy98

Description

@ismoiliy98

Is your feature request related to a problem? Please describe.
Currently, Aurora doesn't transform and parse type definations in Prisma schemas.

Describe the solution you'd like
Add support for type definations in schemas. They should be copied to the output schema file.

Describe alternatives you've considered
N/A

Additional context
Current behavior: it ignores all type definitions:

Input: session.model.schema

datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

model Session {
  id               String                   @id @default(auto()) @map("_id") @db.ObjectId
  sessionId        String                   @unique
  shop             String
  state            String
  isOnline         Boolean
  scope            String
  expires          DateTime?
  accessToken      String
  onlineAccessInfo SessionOnlineAccessInfo?
}

type SessionOnlineAccessInfo {
  expires_in            Int
  associated_user_scope String
  associated_user       SessionAssociatedUser
}

type SessionAssociatedUser {
  id             Int
  first_name     String
  last_name      String
  email          String
  email_verified Boolean
  account_owner  Boolean
  locale         String
  collaborator   Boolean
}

Output: schema.prisma

// ◮◮◮ GENERATED BY AURORA ◮◮◮
datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

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

model Session {
  id               String                   @id @default(auto()) @map("_id") @db.ObjectId
  sessionId        String                   @unique
  shop             String
  state            String
  isOnline         Boolean
  scope            String
  expires          DateTime?
  accessToken      String
  onlineAccessInfo SessionOnlineAccessInfo?
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions