Skip to content

Commit

Permalink
fix(database): IntegrityError
Browse files Browse the repository at this point in the history
  • Loading branch information
HitaloM committed Aug 12, 2024
1 parent f0c9dc1 commit 3072738
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ Changelog

.. towncrier release notes start
1.0.1 (2024-08-12)
==================

Bug Fixes
---------

- Fixed an `IntegrityError` in `korone.database.sqlite.connection` within the `_execute` method. The error occurred due to a UNIQUE constraint violation on `Users.id`.
1.0.0 (2024-08-12)
===================

Expand Down
2 changes: 1 addition & 1 deletion src/korone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .utils.i18n import create_i18n_instance

__version__ = "1.0.0"
__version__ = "1.0.1"

cache = Cache()
cache.setup("redis://localhost", client_side=True)
Expand Down
2 changes: 1 addition & 1 deletion src/korone/database/sqlite/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def insert(self, fields: Document) -> None:
values = tuple(value for value in fields.values() if value is not None)
placeholders = ", ".join("?" for _ in values)

sql = f"INSERT INTO {self._table} ({keys}) VALUES ({placeholders})"
sql = f"INSERT OR IGNORE INTO {self._table} ({keys}) VALUES ({placeholders})"

await logger.adebug("Inserting into table %s: %s", self._table, fields)

Expand Down

0 comments on commit 3072738

Please sign in to comment.