Add PostgreSQL and SQLite support via unified SQL backend #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extends database support from MySQL-only to PostgreSQL and SQLite while maintaining full backward compatibility. Implements a driver abstraction layer allowing users to switch databases via configuration.
Implementation
Driver Abstraction
BaseSqlDriver: Interface defining common operations (connect, query, findUser, etc.)SqlDriverFactory: Creates appropriate driver based onSQL_DRIVERconfig?→$1, $2for PostgreSQL)SQL_QUERY_*environment variablesDrivers
MySQLDriver: Refactored existing implementation to extend base classPostgreSQLDriver: JSONB support with?operator for array membershipSQLiteDriver: JSON1 extension for JSON operationsGeneric Backends
sql.auth.js/sql.directory.js: Dialect-agnostic backends using factory patternmysql.auth.js/mysql.directory.jsunchanged for rollback safetyConfiguration
Migration
Existing deployments continue working unchanged. To use new backend:
Rollback requires only reverting backend name.
Schema
Identical logical schema across all dialects. Initialization scripts provided for each:
docker/sql/init.sqldocker/sql/init-postgresql.sqldocker/sql/init-sqlite.sqlTesting
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.