sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.37k stars 803 forks source link

syntax error at or near "engine" In Create table sql including engine #2013

Closed DennisMuchiri closed 1 year ago

DennisMuchiri commented 1 year ago

What do you want to change?

Please support engine definition when creating schema create table if not exists role ( id binary(16) not null, k varchar(32) not null ) engine=InnoDB; alter table role add primary key(id);

What database engines need to be changed?

PostgreSQL, MySQL

What programming language backends need to be changed?

No response

andrewmbenton commented 1 year ago

The ENGINE=InnoDB syntax appears to only be valid for MySQL. Here's a playground link using MySQL which doesn't break sqlc: https://play.sqlc.dev/p/b68bb1e432a879723eb102e7efe6e6970083a807e2b016067e4af3654fc74774

If you're using MySQL just be sure to set the engine config option to mysql in your sqlc config as documented here: https://docs.sqlc.dev/en/latest/reference/config.html#sql