go-xorm / cmd

Command line tools for database operation written by Go, moved to https://gitea.com/xorm/cmd
BSD 3-Clause "New" or "Revised" License
168 stars 77 forks source link

tag missing on reverse #46

Open Nanyan opened 5 years ago

Nanyan commented 5 years ago

For the columns as follow in MySql :

`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

the reverse tool will generate fields as follow:

CreateTime        time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' TIMESTAMP"`
UpdateTime        time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' TIMESTAMP"`

In this case, CreateTime and UpdateTime fields will not have a correct behavior when user leave it unset (that is, it's value is zero.).

Does this problem is because of missing tag like created, updated when reverse?