## Dokumentation - Entfernt AGENTS.md (redundant zu CLAUDE.md) - Verschoben: 3 Dokumentationen von root → docs/ - Gelöscht: 8 historische Migrations-Pläne aus docs/archive/ - Entfernt: misc/ Ordner komplett (43 Dateien) ## Struktur - Erstellt: database/queries/ für SQL Test-Queries (4 Dateien) - Erstellt: database/schemas/ für Schema-Dokumentation (17 Dateien) - output_keys_mapping/ (8 CSV-Mappings) - migration-diagrams/ (4 Diagramme) ## Code-Qualität - Formatiert: 7 Style-Issues in 74 Dateien mit Laravel Pint - Gefixed: Migration für PostgreSQL/SQLite Kompatibilität - Gefixed: 2 fehlgeschlagene Tests (CSRF + Text-Assertion) ## Tests - Alle 73 Tests bestehen jetzt (100% Success Rate) - AuthenticationTest: CSRF-Token Fix für Logout-Test - CompanySearchTest: Text-Assertion aktualisiert ## Ergebnis - Root ist sauber (nur CLAUDE.md) - Dokumentation strukturiert in docs/ - Database-Dateien organisiert in database/ - Code entspricht Style-Guide - Alle Tests bestehen
52 lines
1.6 KiB
SQL
52 lines
1.6 KiB
SQL
Select * from
|
|
backend2.transactions as t
|
|
left join backend2.transaction_outputs as tout on t.id = tout.transaction_id
|
|
--where t.id = 1 and tout.prompt_id = 98
|
|
--where t.created_at like '2025-11-12%' and tout.prompt_id = 98
|
|
order by transaction_id, prompt_id;
|
|
|
|
|
|
select * from public.transactions
|
|
order by "requires_review" desc, "risk_score" desc, "executed_at" desc
|
|
limit 12 offset 0;
|
|
|
|
|
|
SELECT * FROM information_schema.columns
|
|
WHERE table_schema = 'public' and table_name = 'transactions';
|
|
|
|
/* Abfrage von Werten in JSONB */
|
|
select content_json->'answer' as answer , content_json->
|
|
from public.transaction_outputs
|
|
where transaction_id = 2 --and prompt_id = 2
|
|
order by transaction_id, prompt_id;
|
|
|
|
|
|
-- Einer von mehreren Keys existiert?
|
|
SELECT * FROM public.transaction_outputs
|
|
WHERE content_json ?| array['risk_score', 'risk_level', 'risk_details_json'];
|
|
|
|
select * from backend2.transaction_outputs;
|
|
|
|
|
|
/* Kopieren einer Tabelle von einem Schema in ein neues Schema */
|
|
CREATE TABLE public.transaction_outputs AS
|
|
SELECT * FROM backend.transaction_outputs;
|
|
/* Prüfen ob alle Daten valides Json sind*/
|
|
SELECT content from public.transaction_outputs
|
|
WHERE content IS NOT NULL
|
|
AND content::jsonb IS NULL;
|
|
/* Neue Spalte zur kopierten Tabelle hinzufügen*/
|
|
ALTER TABLE public.transaction_outputs
|
|
ADD COLUMN content_json jsonb;
|
|
/* Kopieren der String Daten in die JSONB Spalte*/
|
|
UPDATE public.transaction_outputs
|
|
SET content_json = content::jsonb
|
|
WHERE content IS NOT NULL;
|
|
/* Index erstellen*/
|
|
CREATE INDEX idx_content_json ON public.transaction_outputs USING gin(content_json);
|
|
CREATE INDEX idx_data_gin ON tablename USING gin(data);
|
|
|
|
|
|
|
|
|