feat: switch from MySQL to SQLite for zero-dependency deployment

- Rewrite db.php to use SQLite via PDO (no external DB server needed)
- Rewrite schema.sql for SQLite (AUTOINCREMENT, CHECK constraints,
  triggers for updated_at, ON CONFLICT instead of ON DUPLICATE KEY)
- Fix config.php upsert to use ON CONFLICT syntax
- Fix index.php: tag filter via json_each, vote upsert via ON CONFLICT,
  and fix protocol create route (was returning 405 for POST /api/protocols)
- Fix yaml.php seed import: replace invalid false callbacks with fn() => null,
  fix yaml_parse pos argument (-1 -> 0)
- Update Dockerfile: drop pdo_mysql/mysqli (pdo_sqlite is built in)
- Update CloudronManifest.json: remove mysql addon, bump to v0.3.0
- Update README for SQLite deployment
This commit is contained in:
Protocolbot
2026-07-06 14:42:45 -06:00
parent 7379d0c540
commit 3386ac6542
8 changed files with 155 additions and 132 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
FROM php:8.2-apache
# Install MySQL PDO extension and YAML extension
RUN docker-php-ext-install pdo pdo_mysql mysqli
# Install YAML extension (pdo_sqlite is already included in php:8.2-apache)
RUN docker-php-ext-install pdo
# Install PECL yaml extension
RUN apt-get update && apt-get install -y libyaml-dev && \
@@ -18,7 +18,7 @@ RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-av
# Copy app files
COPY . /var/www/html/
# Ensure data directory is writable
# Ensure data directory is writable (for SQLite database)
RUN mkdir -p /var/www/html/data && chmod 777 /var/www/html/data
EXPOSE 80