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

Cannot create non nullable field named slug #614

Closed
girardinsamuel opened this issue Mar 29, 2022 · 2 comments
Closed

Cannot create non nullable field named slug #614

girardinsamuel opened this issue Mar 29, 2022 · 2 comments
Labels
bug An existing feature is not working as intended

Comments

@girardinsamuel
Copy link
Contributor

Describe the bug
When using table.string("slug"), we cannot create a record with it.

>>> User.create({"name": "sam", "email": "sam@gmail.com", "password": "secret", "slug": "test"})
Traceback (most recent call last):
  File "/Users/craggeek/.pyenv/versions/m4_01/lib/python3.9/site-packages/masoniteorm/connections/SQLiteConnection.py", line 142, in query
    self.statement(query, bindings)
  File "/Users/craggeek/.pyenv/versions/m4_01/lib/python3.9/site-packages/masoniteorm/connections/BaseConnection.py", line 40, in statement
    self._cursor.execute(query, bindings)
sqlite3.IntegrityError: NOT NULL constraint failed: users.slug

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/craggeek/.pyenv/versions/m4_01/lib/python3.9/site-packages/masoniteorm/models/Model.py", line 452, in create
    return cls.builder.create(dictionary, id_key=cls.__primary_key__)
  File "/Users/craggeek/.pyenv/versions/m4_01/lib/python3.9/site-packages/masoniteorm/query/QueryBuilder.py", line 484, in create
    query_result = connection.query(self.to_qmark(), self._bindings, results=1)
  File "/Users/craggeek/.pyenv/versions/m4_01/lib/python3.9/site-packages/masoniteorm/connections/SQLiteConnection.py", line 150, in query
    raise QueryException(str(e)) from e
masoniteorm.exceptions.QueryException: NOT NULL constraint failed: users.slug

Expected behavior
Should be able to use this field name.

Screenshots or code snippets
Screenshots help a lot. If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS

What database are you using?

  • Type: SQLite

  • Masonite ORM latest

@girardinsamuel girardinsamuel added the bug An existing feature is not working as intended label Mar 29, 2022
@josephmancuso
Copy link
Member

@girardinsamuel were you able to replicate this or did you just make a ticket for it?

@girardinsamuel
Copy link
Contributor Author

I was not able to replicate this on macOS. It kind be a windows issue, but can't replicate this as I don't have Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants