Add action_queue + lore_avancee SQL migration
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
-- Migration fallout DB — tables manquantes
|
||||
-- À exécuter sur Vigile : docker exec -i fallout_db psql -U fallout -d fallout
|
||||
|
||||
-- File d'actions (coeur du moteur de simulation)
|
||||
CREATE TABLE IF NOT EXISTS action_queue (
|
||||
id SERIAL PRIMARY KEY,
|
||||
session_id INTEGER REFERENCES sessions(id),
|
||||
day_in_game INTEGER NOT NULL,
|
||||
hour_in_game INTEGER NOT NULL DEFAULT 0,
|
||||
character_id INTEGER REFERENCES characters(id),
|
||||
action_text TEXT NOT NULL,
|
||||
location VARCHAR(100),
|
||||
target_char_id INTEGER REFERENCES characters(id),
|
||||
target_location VARCHAR(100),
|
||||
scene_id VARCHAR(50), -- groupe les actions qui se croisent
|
||||
status VARCHAR(20) DEFAULT 'pending', -- pending|resolving|resolved|cancelled
|
||||
priority INTEGER DEFAULT 5,
|
||||
result_text TEXT, -- rempli après résolution par le MJ
|
||||
created_at TIMESTAMP DEFAULT now(),
|
||||
resolved_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_aq_session_day_hour ON action_queue(session_id, day_in_game, hour_in_game);
|
||||
CREATE INDEX IF NOT EXISTS idx_aq_status ON action_queue(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_aq_scene ON action_queue(scene_id);
|
||||
|
||||
-- Lore avancée — résumés narratifs générés par le LLM toutes les 24h de jeu
|
||||
CREATE TABLE IF NOT EXISTS lore_avancee (
|
||||
id SERIAL PRIMARY KEY,
|
||||
session_id INTEGER REFERENCES sessions(id),
|
||||
day_start INTEGER NOT NULL,
|
||||
day_end INTEGER NOT NULL,
|
||||
title VARCHAR(200),
|
||||
content TEXT NOT NULL, -- texte narratif généré par MJ 14b
|
||||
factions_involved TEXT[],
|
||||
locations_involved TEXT[],
|
||||
chroma_id VARCHAR(100), -- ref chunk fallout_canon dans ChromaDB
|
||||
created_at TIMESTAMP DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_la_session ON lore_avancee(session_id, day_start);
|
||||
|
||||
-- Vérification
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_schema = 'public'
|
||||
ORDER BY table_name;
|
||||
Reference in New Issue
Block a user