Fix: strip PostgreSQL server_default from email_inbound_token for SQLite
CI / lint (pull_request) Failing after 5s
CI / typecheck (pull_request) Failing after 32s
CI / test (pull_request) Failing after 1m23s
CI / build-and-push (pull_request) Has been skipped
CI / deploy-dev (pull_request) Has been skipped
CI / deploy-uat (pull_request) Has been skipped
CI / lint (pull_request) Failing after 5s
CI / typecheck (pull_request) Failing after 32s
CI / test (pull_request) Failing after 1m23s
CI / build-and-push (pull_request) Has been skipped
CI / deploy-dev (pull_request) Has been skipped
CI / deploy-uat (pull_request) Has been skipped
The email_inbound_token column uses a PostgreSQL-only server_default (gen_random_bytes/encode/trim) that SQLite cannot parse. Strip the server_default before metadata.create_all() in both the sync engine and async db_engine fixtures so tests run against SQLite. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -53,6 +53,10 @@ def disable_rate_limiting():
|
||||
def engine():
|
||||
"""Sync in-memory SQLite engine for model unit tests."""
|
||||
eng = create_engine("sqlite:///:memory:")
|
||||
from cartsnitch_api.models.user import User
|
||||
|
||||
col = User.__table__.columns["email_inbound_token"]
|
||||
col.server_default = None
|
||||
Base.metadata.create_all(eng)
|
||||
yield eng
|
||||
eng.dispose()
|
||||
@@ -77,6 +81,9 @@ async def db_engine():
|
||||
cursor.close()
|
||||
|
||||
async with engine.begin() as conn:
|
||||
from cartsnitch_api.models.user import User
|
||||
|
||||
User.__table__.columns["email_inbound_token"].server_default = None
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
# Create Better-Auth tables (not managed by SQLAlchemy models)
|
||||
await conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user