We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.19.1
The code associated with the enum field is generated even if the table is dropped after define this field.
type StreamSessionState string const ( StreamSessionStateACTIVATING StreamSessionState = "ACTIVATING" StreamSessionStateACTIVE StreamSessionState = "ACTIVE" StreamSessionStateCONNECTED StreamSessionState = "CONNECTED" StreamSessionStatePENDINGCLIENTRECONNECTION StreamSessionState = "PENDING_CLIENT_RECONNECTION" StreamSessionStateTERMINATED StreamSessionState = "TERMINATED" StreamSessionStateERROR StreamSessionState = "ERROR" ) func (e *StreamSessionState) Scan(src interface{}) error { switch s := src.(type) { case []byte: *e = StreamSessionState(s) case string: *e = StreamSessionState(s) default: return fmt.Errorf("unsupported scan type for StreamSessionState: %T", src) } return nil } type NullStreamSessionState struct { StreamSessionState StreamSessionState Valid bool // Valid is true if StreamSessionState is not NULL } // Scan implements the Scanner interface. func (ns *NullStreamSessionState) Scan(value interface{}) error { if value == nil { ns.StreamSessionState, ns.Valid = "", false return nil } ns.Valid = true return ns.StreamSessionState.Scan(value) } // Value implements the driver Valuer interface. func (ns NullStreamSessionState) Value() (driver.Value, error) { if !ns.Valid { return nil, nil } return string(ns.StreamSessionState), nil }
CREATE TABLE `stream_session` ( `id` int NOT NULL AUTO_INCREMENT, `external_id` varchar(256) DEFAULT NULL, `stream_group_id` int NOT NULL, `state` enum('ACTIVATING','ACTIVE','CONNECTED','PENDING_CLIENT_RECONNECTION','TERMINATED','ERROR') NOT NULL, PRIMARY KEY (`id`), KEY `stream_group_id` (`stream_group_id`), CONSTRAINT `stream_session_ibfk_1` FOREIGN KEY (`stream_group_id`) REFERENCES `stream_group` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; DROP TABLE stream_session;
No response
version: "2" sql: - schema: "db/schema/DDL" queries: "db/query" engine: "mysql" gen: go: package: "db" out: "db/sqlc" emit_json_tags: true emit_interface: true emit_empty_slices: true emit_exact_table_names: true
macOS
MySQL
Go
The text was updated successfully, but these errors were encountered:
If you use the config option omit_unused_structs I think sqlc won't generate that enum. But it does seem like this is a bug.
omit_unused_structs
Sorry, something went wrong.
fix(mysql): Add, drop, rename and change enum values (#2853)
39576d6
Extends the work done in #2680 to support adding and dropping columns and tables. Fixes #2475
Successfully merging a pull request may close this issue.
Version
1.19.1
What happened?
The code associated with the enum field is generated even if the table is dropped after define this field.
Relevant log output
Database schema
SQL queries
No response
Configuration
Playground URL
No response
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: