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

Prefer single quotes over double quotes #60

Closed
carsonfarmer opened this issue Dec 2, 2022 · 2 comments · Fixed by #61
Closed

Prefer single quotes over double quotes #60

carsonfarmer opened this issue Dec 2, 2022 · 2 comments · Fixed by #61
Labels
bug Something isn't working

Comments

@carsonfarmer
Copy link

carsonfarmer commented Dec 2, 2022

Describe the bug
When specifying a string defaultValue for a given model, the value is "encoded" with double quotes in the create statement. While this is technically ok with SQLite, it is actually not best practice (https://www.sqlite.org/quirks.html). While I understand that this is not a high-priority issue, it is causing downstream issues for me when use this for local development, so I thought I would submit an issue in case it is hitting anyone else. I'm happy to submit a PR for this (tiny) fix, if that would be accepted.

The following section of a model:

...
name: {
  type: DataTypes.STRING,
  notNull: true,
  defaultValue: "John Doe",
},
...

runs into this on line 138 of current main:

defaultStr = `"${column.defaultValue}"`;

Expected behavior

That line should probably be

defaultStr = `'${column.defaultValue}'`;
@carsonfarmer carsonfarmer added the bug Something isn't working label Dec 2, 2022
Skye-31 added a commit that referenced this issue Dec 2, 2022
Skye-31 added a commit that referenced this issue Dec 2, 2022
@Skye-31
Copy link
Contributor

Skye-31 commented Dec 2, 2022

Hi @carsonfarmer.

Thanks for the issue! This should be resolved in v0.7.2.

@carsonfarmer
Copy link
Author

Amazing, you rock @Skye-31! Thanks for the quick fix, and for this library :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants