Skip to content
New issue

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

Enhancement: include sqlc version in generated files #1456

Closed
zlymeda opened this issue Feb 24, 2022 · 2 comments · Fixed by #1514
Closed

Enhancement: include sqlc version in generated files #1456

zlymeda opened this issue Feb 24, 2022 · 2 comments · Fixed by #1514
Labels
enhancement New feature or request

Comments

@zlymeda
Copy link

zlymeda commented Feb 24, 2022

Currently, sqlc adds this comment to generated files:

// Code generated by sqlc. DO NOT EDIT.

It would be nice to include also the sqlc version, something like:

// Code generated by sqlc v1.12.0. DO NOT EDIT.

Why? If a developer is using an older version of sqlc, he/she would notice that before committing:

- // Code generated by sqlc v1.13.0. DO NOT EDIT.
+ // Code generated by sqlc v1.12.0. DO NOT EDIT.
// ...

What do you think?

@kyleconroy kyleconroy added the enhancement New feature or request label Feb 28, 2022
@kyleconroy
Copy link
Collaborator

I don't think I'm going to add this. My main reason is that it will generate unnecessary diffs every time someone updates sqlc.

@kyleconroy
Copy link
Collaborator

kyleconroy commented Mar 28, 2022

I looked at the protoc output and realized it includes the version of protoc and the version of any plugins.

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
//  protoc-gen-go v1.27.1                                                                                                                                                                                              
//  protoc        v3.19.1
// source: python/ast.proto

I'm going to adopt that format for sqlc (using spaces instead of tabs)

// Code generated by sqlc. DO NOT EDIT.
// versions:
//  sqlc v1.12.0
// source: query.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants