Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issues.js checkDefault and Table default bug #89

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/EditorCanvas/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ export default function Table(props) {
</div>
</div>
{tableData.fields.map((e, i) => {

if (e.default.name && e.default.name[0].value && e.default.name[0].value === 'CURRENT_TIMESTAMP') {
e.default = 'CURRENT_TIMESTAMP'
}

return settings.showFieldSummary ? (
<Popover
key={i}
Expand Down
4 changes: 3 additions & 1 deletion src/utils/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function checkDefault(field) {

if (isFunction(field.default)) return true;

if (Array.isArray(field.default.name)) return true;

if (!field.notNull && field.default.toLowerCase() === "null") return true;

switch (field.type) {
Expand Down Expand Up @@ -124,7 +126,7 @@ export function getIssues(diagram) {
);
}

if (field.notNull && field.default.toLowerCase() === "null") {
if (field.notNull && !Array.isArray(field.default.name) && field.default.toLowerCase() === "null") {
issues.push(
`"${field.name}" field of table "${table.name}" is NOT NULL but has default NULL`,
);
Expand Down