summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Mangano-Tarumi <fmang@mg0.fr>2020-03-21 19:13:45 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2020-03-22 21:50:10 +0100
commit31a5b40b5cf355f3648d5e13d9dbd09b51f7cb2a (patch)
tree22120fb8418eb365e271df63650e145d63a41f29
parent28ba3f77dcd3741b2cb8dc82f47790e130063da7 (diff)
downloadaur-31a5b40b5cf355f3648d5e13d9dbd09b51f7cb2a.tar.gz
aur-31a5b40b5cf355f3648d5e13d9dbd09b51f7cb2a.tar.xz
Map BIGINT to INTEGER for SQLite
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rw-r--r--aurweb/schema.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/aurweb/schema.py b/aurweb/schema.py
index fde6512f..6792cf1d 100644
--- a/aurweb/schema.py
+++ b/aurweb/schema.py
@@ -17,6 +17,17 @@ def compile_tinyint_sqlite(type_, compiler, **kw):
return 'INTEGER'
+@compiles(BIGINT, 'sqlite')
+def compile_bigint_sqlite(type_, compiler, **kw):
+ """
+ For SQLite's AUTOINCREMENT to work on BIGINT columns, we need to map BIGINT
+ to INTEGER. Aside from that, BIGINT is the same as INTEGER for SQLite.
+
+ See https://docs.sqlalchemy.org/en/13/dialects/sqlite.html#allowing-autoincrement-behavior-sqlalchemy-types-other-than-integer-integer
+ """
+ return 'INTEGER'
+
+
metadata = MetaData()
# Define the Account Types for the AUR.