holistics / holistics/dbml

null is not workinig

Open
#218 0 comments 0 reactions 1 assignee Claimed by @huydo862003 View on GitHub
bug
Dominant language
JavaScript
Stars
3.7k
Forks
233
Avg merge
1d 23h
Merged PRs (30d)
4

Description

my dbms is mysql.
And my dbms timestamp defulat value is not null

But I export this code to mysql , the null option disappears.

this code
```
withdrawal_at timestamp [null, default: null]
```
export code to mysql
```
`withdrawal_at` timestamp DEFAULT null
```

So I got a "1067 : Invalid default value for 'withdrawal_at" warning.

How do I explicitly give the null property?

All code
dbdiagram Code
```
Table users {
id "int unsigned" [pk, increment] // auto-increment
username varchar [unique, not null]
password varchar(255) [not null]
name varchar [not null]
phone varchar [not null]

master_id "int unsigned" [null, default: null, ref: > users.id]
farm_alias varchar(3) [null, default: null]
user_type "int unsigned" [not null, ref: > code_user_type.id]

device_token varchar(255) [null, default: null]

register_at timestamp [not null, default: `current_timestamp`]
withdrawal_at timestamp [null, default: null]
updated_at timestamp [not null, default: `current_timestamp ON UPDATE current_timestamp`]
}
```
export code
```
CREATE TABLE `users` (
`id` int unsigned PRIMARY KEY AUTO_INCREMENT,
`username` varchar(255) UNIQUE NOT NULL ,
`password` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`phone` varchar(255) NOT NULL,
`master_id` int unsigned DEFAULT null,
`farm_alias` varchar(3) DEFAULT null,
`user_type` int unsigned NOT NULL,
`device_token` varchar(255) DEFAULT null,
`register_at` timestamp NOT NULL DEFAULT (current_timestamp),
`withdrawal_at` timestamp DEFAULT null,
`updated_at` timestamp NOT NULL DEFAULT (current_timestamp ON UPDATE current_timestamp)
);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.