Hi,
I am new to dbdiagram.io
I have a table definition as
Table entity
{
id bigint [pk, increment, unique, note: 'The database table row id']
dateCreated timestamp [default: 'now()', note: 'Date / time created']
dateEdited timestamp [default: 'now()', note: 'Date / time last modified']
createdBy varchar(40) [not null, default: '', note: 'The person who created the record']
editedBy varchar(40) [not null, default: '', note: 'The person who last modified the record']
constituentId varchar(40) [unique, not null, default: `uuid_generate_v4()`, note: 'The globally unique identifier for this constituent']
name varchar(255) [not null]
ein varchar(16) [unique, not null]
indexes
{
constituentId
ein
}
}
When I export to MySql the following is generated.
CREATE TABLE `entity` (
`id` bigint UNIQUE PRIMARY KEY AUTO_INCREMENT COMMENT 'The database table row id',
`dateCreated` timestamp DEFAULT "now()" COMMENT 'Date / time created',
`dateEdited` timestamp DEFAULT "now()" COMMENT 'Date / time last modified',
`createdBy` varchar(40) NOT NULL DEFAULT "" COMMENT 'The person who created the record',
`editedBy` varchar(40) NOT NULL DEFAULT "" COMMENT 'The person who last modified the record',
`constituentId` varchar(40) UNIQUE NOT NULL DEFAULT (uuid_generate_v4()) COMMENT 'The globally unique identifier for this constituent',
`name` varchar(255) NOT NULL,
`ein` varchar(16) UNIQUE NOT NULL
);
The MySql export doesn’t like the syntax of the resulting CREATE TABLE - it doesn’t like the double quotes around the now
keyword.
I also noticed that the double quotes with the DEFAULT
command is also an issue. MySql seems to want single quotes.