sqlc
sqlc copied to clipboard
Support MariaDB default values for timestamp
What do you want to change?
If I create a table like for example:
CREATE TABLE IF NOT EXISTS `session` (
`id` INT NOT NULL,
`expiry` TIMESTAMP NOT NULL DEFAULT (CURRENT_TIMESTAMP + INTERVAL 30 DAY),
PRIMARY KEY (`id`)
);
Currently this default for the expiry will not work as it causes syntax error, as this isn't a feature for mysql but only mariadb from my understanding. It would be nice to have these more programmatic defaults work with sqlc.
What database engines need to be changed?
MySQL
What programming language backends need to be changed?
No response
I have hit this issue as well with table creation succeeds on mysql 8.x but fails with sqlc
create table invitations
(
id bigint auto_increment primary key,
email varchar(255) not null,
code varchar(36) not null,
expires datetime default ((now() + interval 90 minute)) not null,
created_at datetime default now() not null
);
sqlc/mysql/migrations/0232_schema_invitations.up.sql:8:38: syntax error near "+ INTERVAL 90 MINUTE),"