Skip to content

Commit

Permalink
Merge pull request #15 from emyann/feat/update-prisma-to-rc
Browse files Browse the repository at this point in the history
Feat: Update prisma to rc
  • Loading branch information
emyann authored Jul 23, 2020
2 parents ed6c0d9 + b0b8b8e commit 56eceb4
Show file tree
Hide file tree
Showing 5 changed files with 213 additions and 503 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ prisma-uml <path> [--output] [--server] [--file]
**Argument**

| Name | Description |
| -------- | ---------------------- |
|----------|------------------------|
| **path** | Path to Prisma schema. |

**Options**

| Name | Alias | Description | Type / Choices | Default |
| ------------ | ----- | ------------------------------------ | ------------------------------------ | --------------------------------- |
|--------------|-------|--------------------------------------|--------------------------------------|-----------------------------------|
| **--output** | -o | Output of the diagram | string / [text \| svg \| png \| jpg] | text |
| **--server** | -s | PlantUML Server URL | string | https://www.plantuml.com/plantuml |
| **--file** | -f | Filename or File full path to output | string | |
Expand Down Expand Up @@ -113,6 +113,7 @@ prisma-uml ./schema.prisma --server http://localhost:8080
- [ ] Feat: Display Version Number
- [ ] Feat: Handle `-o text -f my-erd.puml|.wsd|.plantuml...`
- [ ] Remove `--output` in favor of extension handling (.svg, .png, .jpg, .puml...) (?)
- [ ] Fix: Multiple cardinalities when should be online one (see simple example)
- [ ] Feat: Add logging to stdout to describe what the CLI is doing

## Authors
Expand Down
12 changes: 5 additions & 7 deletions examples/simple/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ model User {
id String @default(cuid()) @id
firstName String?
lastName String?
mainDogs Dog[] @relation("mainDogs")
dogs Dog[]
profile Profile
}
Expand All @@ -24,11 +23,10 @@ model Profile {
}

model Dog {
id String @default(cuid()) @id
owner User @relation(fields: [ownerId], references: [id])
ownerId String
breed Breed
userId String?
id String @default(cuid()) @id
breed Breed
userId String?
user User? @relation(fields: [userId], references: [id])
}

enum Breed {
Expand All @@ -39,4 +37,4 @@ enum Breed {
enum Role {
Admin
User
}
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@
"ts-node-dev": "^1.0.0-pre.44",
"tsconfig-paths": "^3.9.0",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslib": "^1.11.1",
"tslib": "^2.0.0",
"typescript": "^3.8.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-node-externals": "^1.7.2"
},
"dependencies": {
"@prisma/sdk": "^2.0.0-beta.2",
"@prisma/sdk": "^2.3.0",
"axios": "^0.19.2",
"chalk": "^4.1.0",
"typescript-generic-datastructures": "^1.3.0",
"uuid": "^7.0.3",
"yargs": "^15.3.2-beta.0",
"snyk": "^1.359.0"
"uuid": "^8.2.0",
"yargs": "^15.4.1",
"snyk": "^1.364.2"
},
"snyk": true
}
11 changes: 11 additions & 0 deletions src/core/entity/prismaModelToPlantUMLEntity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ describe('Entity', () => {
isEmbedded: false,
name: 'MyModel',
fields: [],
uniqueFields: [],
uniqueIndexes: [],
};

const expected = `entity MyModel {
Expand All @@ -22,12 +24,15 @@ describe('Entity', () => {
dbName: '',
idFields: [],
isEmbedded: false,
uniqueFields: [],
uniqueIndexes: [],
name: 'MyModel',
fields: [
{
name: 'Field1',
type: 'String',
kind: 'scalar',
hasDefaultValue: false,
isList: false,
isRequired: false,
isUnique: false,
Expand All @@ -51,11 +56,14 @@ describe('Entity', () => {
idFields: [],
isEmbedded: false,
name: 'MyModel',
uniqueFields: [],
uniqueIndexes: [],
fields: [
{
name: 'Field1',
type: 'String',
kind: 'scalar',
hasDefaultValue: false,
isList: false,
isRequired: true,
isUnique: false,
Expand All @@ -79,11 +87,14 @@ describe('Entity', () => {
idFields: [],
isEmbedded: false,
name: 'MyModel',
uniqueFields: [],
uniqueIndexes: [],
fields: [
{
name: 'Field1',
type: 'String',
kind: 'scalar',
hasDefaultValue: false,
isList: true,
isRequired: true,
isUnique: false,
Expand Down
Loading

0 comments on commit 56eceb4

Please sign in to comment.