ygrek / sqlgg

SQL Guided (code) Generator
https://ygrek.org/p/sqlgg/
GNU General Public License v2.0
62 stars 20 forks source link

timestamp field not set by mysql bindings #49

Closed cyberhuman closed 6 years ago

cyberhuman commented 6 years ago

schema

CREATE TABLE `test` (
  `created_at` TIMESTAMP NOT NULL DEFAULT NOW()
);
-- @add
INSERT INTO `test` (`created_at`) VALUES;

after running

Sql.add dbd ~created_at:(Unix.time ())

created_at is not set in the database:

MariaDB [test]>  select * from test;
+---------------------+
| created_at          |
+---------------------+
| 0000-00-00 00:00:00 |
+---------------------+
1 row in set (0.00 sec)
ygrek commented 6 years ago

This seems to be a problem of traits implementation :

type datetime = float

They assume datetime accepts integers, guess was never tested :]