sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Sqlc unable to update enum in models when using ALTER

Open ken2057 opened this issue 3 years ago • 0 comments

Version

1.12.0

What happened?

When I modify a enum field with ALERT command, the generated models not added a new enum value, and it change the data tpy e of field in struct as string instead of the "type ...Status string".

Relevant log output

No response

Database schema

CREATE TABLE authors (
  id   bigint primary key,
  status enum("ok", "init") default "init" not null
);

-- remove this alter to see the change in models.go
ALTER TABLE authors MODIFY status enum('init', 'done', 'canceled', 'processing', 'waiting') default "init" not null;

SQL queries

-- name: ListAuthors :many
select * from authors;

Configuration

No response

Playground URL

https://play.sqlc.dev/p/67134f04f43f5f6161fb11737e860c99c5db8a82b63d9f0a22e0f5707c500d57

What operating system are you using?

Linux

What database engines are you using?

MySQL

What type of code are you generating?

Go

ken2057 avatar Mar 22 '22 03:03 ken2057