Skip to content

Commit

Permalink
fix: type of note field that is string doesn show
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrxyy committed Dec 24, 2023
1 parent 650687f commit 70ec8f6
Show file tree
Hide file tree
Showing 8 changed files with 1,678 additions and 2,358 deletions.
6 changes: 3 additions & 3 deletions packages/dbml-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"scripts": {
"test": "jest",
"benchmark": "jest --projects jest-bench.config.json",
"build:lib": "babel src --out-dir lib --copy-files",
"build:parser": "npx babel-node src/parse/buildParser.js",
"build:lib": "babel src --out-dir lib --copy-files --watch",
"build:parser": "npx babel-node src/parse/buildParser.js --watch",
"build": "npm run build:parser && npm run build:lib",
"prepublish": "npm run build"
},
Expand Down Expand Up @@ -60,4 +60,4 @@
}
},
"gitHead": "5cb80e1aa38fb9a4dbe3079e39c9ef93cd4dc556"
}
}
4 changes: 2 additions & 2 deletions packages/dbml-core/src/model_structure/database.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from 'lodash';
import _, { get } from 'lodash';
import Schema from './schema';
import Ref from './ref';
import Enum from './enum';
Expand All @@ -25,7 +25,7 @@ class Database extends Element {
this.generateId();
this.hasDefaultSchema = false;
this.schemas = [];
this.note = project.note ? project.note.value : null;
this.note = project.note ? get(project, 'note.value', project.note) : null;
this.noteToken = project.note ? project.note.token : null;
this.databaseType = project.database_type;
this.name = project.name;
Expand Down
3 changes: 2 additions & 1 deletion packages/dbml-core/src/model_structure/enum.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { get } from 'lodash';
import Element from './element';
import EnumValue from './enumValue';
import { shouldPrintSchema } from './utils';
Expand All @@ -9,7 +10,7 @@ class Enum extends Element {
super(token);
if (!name) { this.error('Enum must have a name'); }
this.name = name;
this.note = note ? note.value : null;
this.note = note ? get(note, 'value', note) : null;
this.noteToken = note ? note.token : null;
this.values = [];
this.fields = [];
Expand Down
3 changes: 2 additions & 1 deletion packages/dbml-core/src/model_structure/enumValue.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { get } from 'lodash';
import Element from './element';

class EnumValue extends Element {
Expand All @@ -7,7 +8,7 @@ class EnumValue extends Element {
super(token);
if (!name) { this.error('Enum value must have a name'); }
this.name = name;
this.note = note ? note.value : null;
this.note = note ? get(note, 'value', note) : null;
this.noteToken = note ? note.token : null;
this._enum = _enum;
this.dbState = this._enum.dbState;
Expand Down
3 changes: 2 additions & 1 deletion packages/dbml-core/src/model_structure/field.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { get } from 'lodash';
import Element from './element';
import { DEFAULT_SCHEMA_NAME } from './config';

Expand All @@ -15,7 +16,7 @@ class Field extends Element {
this.unique = unique;
this.pk = pk;
this.not_null = notNull;
this.note = note ? note.value : null;
this.note = note ? get(note, 'value', note) : null;
this.noteToken = note ? note.token : null;
this.dbdefault = dbdefault;
this.increment = increment;
Expand Down
3 changes: 2 additions & 1 deletion packages/dbml-core/src/model_structure/schema.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { get } from 'lodash';
import Table from './table';
import Element from './element';
import Enum from './enum';
Expand All @@ -15,7 +16,7 @@ class Schema extends Element {
this.tableGroups = [];
this.refs = [];
this.name = name;
this.note = note ? note.value : null;
this.note = note ? get(note, 'value', note) : null;
this.noteToken = note ? note.token : null;
this.alias = alias;
this.database = database;
Expand Down
3 changes: 2 additions & 1 deletion packages/dbml-core/src/model_structure/table.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { get } from 'lodash';
import Element from './element';
import Field from './field';
import Index from './indexes';
Expand All @@ -11,7 +12,7 @@ class Table extends Element {
super(token);
this.name = name;
this.alias = alias;
this.note = note ? note.value : null;
this.note = note ? get(note, 'value', note) : null;
this.noteToken = note ? note.token : null;
this.headerColor = headerColor;
this.fields = [];
Expand Down
4,011 changes: 1,663 additions & 2,348 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 70ec8f6

Please sign in to comment.