Replace the legacy mule-image backend with PhotoPrism plus a thin SvelteKit client and a Node sidecar for endpoints PhotoPrism doesn't expose (file rename), and add a two-phase migrator (metadata via PUT, heaps → albums) for the existing Postgres library. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
1.2 KiB
SQL
26 lines
1.2 KiB
SQL
-- Bootstraps the `mule_sidecar` database + user used by the Go sidecar
|
|
-- service (per-user heap sharing + folder mutations, stood up in M4).
|
|
--
|
|
-- MariaDB runs every .sql in /docker-entrypoint-initdb.d ONCE, on first
|
|
-- boot of a fresh data volume. Subsequent boots are no-ops.
|
|
--
|
|
-- The sidecar's MariaDB user is intentionally scoped to `mule_sidecar.*`
|
|
-- only — it never has access to PhotoPrism's schema.
|
|
|
|
CREATE DATABASE IF NOT EXISTS mule_sidecar
|
|
CHARACTER SET utf8mb4
|
|
COLLATE utf8mb4_unicode_ci;
|
|
|
|
-- The password here is substituted at compose build time via envsubst,
|
|
-- but MariaDB's init script doesn't expand vars in .sql files. So we use
|
|
-- a literal placeholder that the user replaces locally — or, simpler,
|
|
-- we let the M4 sidecar bring-up script create the user via SQL with the
|
|
-- env-var password. Keeping a placeholder here makes the schema visible
|
|
-- in source control without leaking creds.
|
|
--
|
|
-- TODO (M4): replace this block with an entrypoint that templates the
|
|
-- password from $SIDECAR_DB_PASSWORD before MariaDB reads the file.
|
|
CREATE USER IF NOT EXISTS 'sidecar'@'%' IDENTIFIED BY 'replace-at-m4-bringup';
|
|
GRANT ALL PRIVILEGES ON mule_sidecar.* TO 'sidecar'@'%';
|
|
FLUSH PRIVILEGES;
|