Files
AFC-Demo/database/queries/migrate-tables-to-archive.sql
T
cbazza 1cb38d7080 chore: major project cleanup and restructuring
## 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
2025-11-21 10:00:32 +01:00

69 lines
3.1 KiB
SQL

-- =====================================================
-- Migration Script: Move Non-Laravel Tables to Archive
-- =====================================================
-- This script creates a new schema 'public_archiv' and
-- moves all tables that were not created by Laravel
-- migrations from the 'public' schema to 'public_archiv'.
-- =====================================================
-- Step 1: Create new schema
CREATE SCHEMA IF NOT EXISTS public_archiv;
-- Step 2: Move tables to public_archiv schema
-- (28 tables that were not created by Laravel migrations)
ALTER TABLE public.alembic_version SET SCHEMA public_archiv;
ALTER TABLE public.bundesanzeiger_cache SET SCHEMA public_archiv;
ALTER TABLE public.companies_view SET SCHEMA public_archiv;
ALTER TABLE public.company_gleif_cache SET SCHEMA public_archiv;
ALTER TABLE public.company_master_data SET SCHEMA public_archiv;
ALTER TABLE public.company_master_data_links SET SCHEMA public_archiv;
ALTER TABLE public.company_opencorporates_cache SET SCHEMA public_archiv;
ALTER TABLE public.company_registry_cache SET SCHEMA public_archiv;
ALTER TABLE public.dpma_cache SET SCHEMA public_archiv;
ALTER TABLE public.entity_corporate_context SET SCHEMA public_archiv;
ALTER TABLE public.eu_sanctions_cache SET SCHEMA public_archiv;
ALTER TABLE public.evidence_registry SET SCHEMA public_archiv;
ALTER TABLE public.genesis_cache SET SCHEMA public_archiv;
ALTER TABLE public.govdata_cache SET SCHEMA public_archiv;
ALTER TABLE public.handelsregister_cache SET SCHEMA public_archiv;
ALTER TABLE public.handelsregister_document_links SET SCHEMA public_archiv;
ALTER TABLE public.handelsregister_documents SET SCHEMA public_archiv;
ALTER TABLE public.handelsregister_entities SET SCHEMA public_archiv;
ALTER TABLE public.handelsregister_entity_transactions SET SCHEMA public_archiv;
ALTER TABLE public.handelsregister_relations SET SCHEMA public_archiv;
ALTER TABLE public.insolvency_cache SET SCHEMA public_archiv;
ALTER TABLE public.pep_cache SET SCHEMA public_archiv;
ALTER TABLE public.prompt_runs SET SCHEMA public_archiv;
ALTER TABLE public.prompt_templates SET SCHEMA public_archiv;
ALTER TABLE public.rss_cache SET SCHEMA public_archiv;
ALTER TABLE public.sanctions_cache SET SCHEMA public_archiv;
ALTER TABLE public.test_transaction_llm SET SCHEMA public_archiv;
ALTER TABLE public.transaction SET SCHEMA public_archiv;
ALTER TABLE public.transaction_outputs SET SCHEMA public_archiv;
ALTER TABLE public.transactions_enriched SET SCHEMA public_archiv;
-- =====================================================
-- Verification Queries
-- =====================================================
-- Check tables in public_archiv schema
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public_archiv'
ORDER BY table_name;
-- Check remaining tables in public schema (should only be Laravel tables)
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
ORDER BY table_name;
-- Count tables per schema
SELECT
table_schema,
COUNT(*) as table_count
FROM information_schema.tables
WHERE table_schema IN ('public', 'public_archiv')
GROUP BY table_schema;