Database Hardening: - Add docker-compose.db.yml with persistent PostgreSQL volume - Add automatic DB backups every 12h (7 days, 4 weeks, 6 months retention) - Add MinIO S3-compatible storage for assets Assets Migration: - Add MinIO client (lib/assets_client.py) for upload/delete - Update upload endpoint to use MinIO (with local fallback) - Add migration 043_asset_urls_to_text.sql for full HTTPS URLs - Simplify normalizeAssetUrl for S3 URLs Recovery: - Add seed_full_city_reset.py for emergency city recovery - Add DB_RESTORE.md with backup restore instructions - Add SEED_RECOVERY.md with recovery procedures - Add INFRA_ASSETS_MINIO.md with MinIO setup guide Task: TASK_PHASE_DATABASE_HARDENING_AND_ASSETS_MIGRATION_v1
34 lines
1.4 KiB
SQL
34 lines
1.4 KiB
SQL
-- 043_asset_urls_to_text.sql
|
|
-- Migration: Change asset URL fields to text to support full HTTPS URLs from MinIO/S3
|
|
|
|
-- MicroDAO logo and banner URLs
|
|
ALTER TABLE microdao
|
|
ALTER COLUMN logo_url TYPE text,
|
|
ALTER COLUMN banner_url TYPE text;
|
|
|
|
COMMENT ON COLUMN microdao.logo_url IS 'Full HTTPS URL to logo image (e.g., https://assets.daarion.space/daarion-assets/microdao/logo/...)';
|
|
COMMENT ON COLUMN microdao.banner_url IS 'Full HTTPS URL to banner image (e.g., https://assets.daarion.space/daarion-assets/microdao/banner/...)';
|
|
|
|
-- Agent avatar URLs
|
|
ALTER TABLE agents
|
|
ALTER COLUMN avatar_url TYPE text;
|
|
|
|
COMMENT ON COLUMN agents.avatar_url IS 'Full HTTPS URL to avatar image (e.g., https://assets.daarion.space/daarion-assets/agents/avatar/...)';
|
|
|
|
-- City rooms logo and banner (if exists)
|
|
DO $$
|
|
BEGIN
|
|
IF EXISTS (SELECT 1 FROM information_schema.columns
|
|
WHERE table_name = 'city_rooms' AND column_name = 'logo_url') THEN
|
|
ALTER TABLE city_rooms ALTER COLUMN logo_url TYPE text;
|
|
COMMENT ON COLUMN city_rooms.logo_url IS 'Full HTTPS URL to room logo image';
|
|
END IF;
|
|
|
|
IF EXISTS (SELECT 1 FROM information_schema.columns
|
|
WHERE table_name = 'city_rooms' AND column_name = 'banner_url') THEN
|
|
ALTER TABLE city_rooms ALTER COLUMN banner_url TYPE text;
|
|
COMMENT ON COLUMN city_rooms.banner_url IS 'Full HTTPS URL to room banner image';
|
|
END IF;
|
|
END $$;
|
|
|