You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: SQL Syntax Error "IF NOT EXISTS" on PostgreSQL 16+ Migrations #837
While attempting to run httpsms with a PostgreSQL 18.3 (Alpine) backend, the auto-migration fails during the schema initialization/update phase. The application attempts to use IF NOT EXISTS syntax for ALTER TABLE ... ADD CONSTRAINT, which is not supported in standard PostgreSQL.
Error Logs:
ERROR: syntax error at or near "EXISTS" at character 42
STATEMENT:
ALTER TABLE users ADD CONSTRAINT IF NOT EXISTS uni_users_api_key CHECK (api_key IS NOT NULL);
ALTER TABLE phone_api_keys ADD CONSTRAINT IF NOT EXISTS uni_phone_api_keys_api_key CHECK (api_key IS NOT NULL);
ALTER TABLE discords ADD CONSTRAINT IF NOT EXISTS uni_discords_server_id CHECK (server_id IS NOT NULL);
Steps to Reproduce:
Use a standard postgres:alpine image in a docker-compose setup.
Point the httpsms API service to this database.
Observe the logs during the initial container startup/migration phase.
Activity
AchoArnold commentedon Mar 22, 2026
Thanks For the bug report @Ankitd013 The issue has been fixed in my latest commit.