Giter Club home page Giter Club logo

Comments (8)

xuliang520914 avatar xuliang520914 commented on September 22, 2024 7
created_at "timestamp default CURRENT_TIMESTAMP" [not null,note:'create time']
updated_at "timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" [not null,note:'update time']

from dbml.

kenng avatar kenng commented on September 22, 2024 6

Ops, I am sorry as I think I have misled you. The original issue is with exporting to MYSQL from the dbdiagram.

I have just tested again to export syntax
created_at timestamp [default: `now()`]

the MYSQL syntax being exported is

`created_at` timestamp DEFAULT (now())

This will make MYSQL 5.7.18 to throw error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(now())
)'

Supported syntax is (without additional parenthesis wrapping the now())

`created_at` timestamp DEFAULT now()

from dbml.

cottonball97 avatar cottonball97 commented on September 22, 2024 5

Hi, i'm from Dbdiagram Team,
With now() you should wrap it between the backtick as `now()` since 'now()' will be exported as a string, not a function.
I'm testing the code created_at timestamp DEFAULT (now()) in MySQL 8.0.16 and it's working fine :D
About the import feature, the new version will be deployed within this week so stay tuned and this problem will be resolved ^^
Thanks for your feedback!

from dbml.

kenng avatar kenng commented on September 22, 2024 1

That would be awesome! Let us know when it's updated

from dbml.

blessedjasonmwanza avatar blessedjasonmwanza commented on September 22, 2024 1

Hi @cottonball97 , I have been reading up online and can't seem to find documentation on how to implement ON UPDATE CURRENT_TIMESTAMP using DbDiagram.

May you kindly share some Intel on how I can implement the ON update function?
your help will be highly appreciated/>

from dbml.

cottonball97 avatar cottonball97 commented on September 22, 2024

The new parser for import has been released! You can now import DEFAULT CURRENT_TIMESTAMP & DEFAULT now() smoothly :)
We did our best but it still seems to be buggy so please do give it another round and tell us if there's anything wrong happened to you. We're happy to help!

from dbml.

Arslan90 avatar Arslan90 commented on September 22, 2024

Hello, thanks for this handful tool, but I would like to point out that the issue is still unsolved for MySQL5.7 version

from dbml.

XedinUnknown avatar XedinUnknown commented on September 22, 2024

Yep, this is certainly still manifests on MySQL 5.6, which is still the most used version around. Please correct this: the docs claim that it will convert between DBML and MySQL no problem, but it certainly is not, at least in dbdiagram.io. I'm not sure if it is supposed to correspond 1:1 with latest DBML, but I'm not sure why it wouldn't be.

from dbml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.