Backend Go: - Remplacement complet des anciennes migrations par la base V1 alignée sur ORIGIN. - Durcissement global du parsing JSON (BindAndValidateJSON + RespondWithAppError). - Sécurisation de config.go, CORS, statuts de santé et monitoring. - Implémentation des transactions P0 (RBAC, duplication de playlists, social toggles). - Ajout d’un job worker structuré (emails, analytics, thumbnails) + tests associés. - Nouvelle doc backend : AUDIT_CONFIG, BACKEND_CONFIG, AUTH_PASSWORD_RESET, JOB_WORKER_*. Chat server (Rust): - Refonte du pipeline JWT + sécurité, audit et rate limiting avancé. - Implémentation complète du cycle de message (read receipts, delivered, edit/delete, typing). - Nettoyage des panics, gestion d’erreurs robuste, logs structurés. - Migrations chat alignées sur le schéma UUID et nouvelles features. Stream server (Rust): - Refonte du moteur de streaming (encoding pipeline + HLS) et des modules core. - Transactions P0 pour les jobs et segments, garanties d’atomicité. - Documentation détaillée de la pipeline (AUDIT_STREAM_*, DESIGN_STREAM_PIPELINE, TRANSACTIONS_P0_IMPLEMENTATION). Documentation & audits: - TRIAGE.md et AUDIT_STABILITY.md à jour avec l’état réel des 3 services. - Cartographie complète des migrations et des transactions (DB_MIGRATIONS_*, DB_TRANSACTION_PLAN, AUDIT_DB_TRANSACTIONS, TRANSACTION_TESTS_PHASE3). - Scripts de reset et de cleanup pour la lab DB et la V1. Ce commit fige l’ensemble du travail de stabilisation P0 (UUID, backend, chat et stream) avant les phases suivantes (Coherence Guardian, WS hardening, etc.).
55 lines
1.7 KiB
SQL
55 lines
1.7 KiB
SQL
-- Migration: Create playlist_follows table
|
|
-- T0489: Create Playlist Follow Feature
|
|
|
|
-- Create playlist_follows table
|
|
CREATE TABLE IF NOT EXISTS playlist_follows (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
playlist_id BIGINT NOT NULL,
|
|
user_id BIGINT NOT NULL,
|
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
deleted_at TIMESTAMP,
|
|
|
|
-- Foreign keys
|
|
CONSTRAINT fk_playlist_follows_playlist
|
|
FOREIGN KEY (playlist_id)
|
|
REFERENCES playlists(id)
|
|
ON DELETE CASCADE,
|
|
|
|
CONSTRAINT fk_playlist_follows_user
|
|
FOREIGN KEY (user_id)
|
|
REFERENCES users(id)
|
|
ON DELETE CASCADE,
|
|
|
|
-- Unique constraint: un utilisateur ne peut suivre une playlist qu'une fois
|
|
CONSTRAINT uq_playlist_follows_playlist_user
|
|
UNIQUE (playlist_id, user_id)
|
|
);
|
|
|
|
-- Create indexes
|
|
CREATE INDEX IF NOT EXISTS idx_playlist_follows_playlist_id
|
|
ON playlist_follows(playlist_id)
|
|
WHERE deleted_at IS NULL;
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_playlist_follows_user_id
|
|
ON playlist_follows(user_id)
|
|
WHERE deleted_at IS NULL;
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_playlist_follows_deleted_at
|
|
ON playlist_follows(deleted_at);
|
|
|
|
-- Add comment
|
|
COMMENT ON TABLE playlist_follows IS 'Table des follows de playlists par les utilisateurs';
|
|
|
|
-- Add follower_count column to playlists table if it doesn't exist
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
SELECT 1 FROM information_schema.columns
|
|
WHERE table_name = 'playlists' AND column_name = 'follower_count'
|
|
) THEN
|
|
ALTER TABLE playlists ADD COLUMN follower_count INTEGER DEFAULT 0;
|
|
CREATE INDEX IF NOT EXISTS idx_playlists_follower_count ON playlists(follower_count);
|
|
END IF;
|
|
END $$;
|
|
|