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

Use sql comments as output by diesel print-schema, if present #144

Open
SamuelMarks opened this issue Dec 3, 2024 · 5 comments
Open

Use sql comments as output by diesel print-schema, if present #144

SamuelMarks opened this issue Dec 3, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@SamuelMarks
Copy link
Contributor

How should this be supported? - I'm thinking:

CREATE TABLE "profiles" (
    alias             VARCHAR(50) PRIMARY KEY    -- user-modifiable alias
);

Or maybe:

COMMENT ON COLUMN profiles.alias IS 'user-modifiable alias';

Or something else? - What do you think?

Here's the current code FWIW: https://github.com/Wulf/dsync/blob/2797966/src/code.rs#L360

@hasezoey
Copy link
Collaborator

hasezoey commented Dec 3, 2024

I do not understand what this feature request is. Are you asking to support using column documentation from the raw .sql files?
If that is the case, then dsync will very likely not support that as dsync only reads the schema.rs file as output by diesel print-schema. If in the future that command should output those comments, then it would be a good option to add such a thing to dsync.

@hasezoey hasezoey added enhancement New feature or request question Further information is requested labels Dec 3, 2024
@SamuelMarks
Copy link
Contributor Author

Ok so you're saying I should send a PR to diesel with this?

Is there a preferred way you want it, e.g., one of the approaches I just mentioned?

@hasezoey
Copy link
Collaborator

hasezoey commented Dec 3, 2024

Is there a preferred way you want it, e.g., one of the approaches I just mentioned?

That is better asked the diesel developers.

Ok so you're saying I should send a PR to diesel with this?

Yes, dsync does not read the raw sql files or interacts with any live databases, it only reads schema.rs which is generated by diesel print-schema, which in turn does interact with live databases (IIRC).

PS: diesel print-schema already outputs some comments, just not from the sql file(s) or the live database to my knowledge, see this example output.

@SamuelMarks
Copy link
Contributor Author

SamuelMarks commented Dec 3, 2024

Ok I've made a new issue on diesel; would appreciate your commentary there if you have an opinion :)

diesel-rs/diesel#4375

@hasezoey
Copy link
Collaborator

hasezoey commented Dec 3, 2024

Considering that diesel-rs/diesel#4375 mentions that print-schema --with-docs already reads and output sql comments, it is reasonable to re-open this issue.

@hasezoey hasezoey reopened this Dec 3, 2024
@hasezoey hasezoey changed the title Column comments instead of "/// Field representing column " Use sql comments as output by diesel print-schema, if present Dec 3, 2024
@hasezoey hasezoey removed the question Further information is requested label Dec 3, 2024
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

No branches or pull requests

2 participants