mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: Switch to postgres
Migrate from MariaDB to PostgreSQL. Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
4637b2edba
commit
fa5dd2ca2c
64 changed files with 560 additions and 615 deletions
|
@ -7,7 +7,7 @@ All functions in this module raise aurweb.exceptions.ValidationError
|
|||
when encountering invalid criteria and return silently otherwise.
|
||||
"""
|
||||
from fastapi import Request
|
||||
from sqlalchemy import and_
|
||||
from sqlalchemy import and_, func
|
||||
|
||||
from aurweb import aur_logging, config, db, l10n, models, time, util
|
||||
from aurweb.auth import creds
|
||||
|
@ -157,7 +157,11 @@ def username_in_use(
|
|||
) -> None:
|
||||
exists = (
|
||||
db.query(models.User)
|
||||
.filter(and_(models.User.ID != user.ID, models.User.Username == U))
|
||||
.filter(
|
||||
and_(
|
||||
models.User.ID != user.ID, func.lower(models.User.Username) == U.lower()
|
||||
)
|
||||
)
|
||||
.exists()
|
||||
)
|
||||
if db.query(exists).scalar():
|
||||
|
@ -175,7 +179,9 @@ def email_in_use(
|
|||
) -> None:
|
||||
exists = (
|
||||
db.query(models.User)
|
||||
.filter(and_(models.User.ID != user.ID, models.User.Email == E))
|
||||
.filter(
|
||||
and_(models.User.ID != user.ID, func.lower(models.User.Email) == E.lower())
|
||||
)
|
||||
.exists()
|
||||
)
|
||||
if db.query(exists).scalar():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue