- Add krs_raw_data, krs_fetched_at, krs_registration_date, krs_representation, krs_activities columns to Company model - Save complete KRS API response for full data access - Display in company profile: - Board members (zarząd) with functions and avatars - Shareholders (wspólnicy) with share amounts - Representation method (sposób reprezentacji) - Business activities (PKD codes) - Registration date with years active - KRS address with region info - OPP (public benefit) status - Metadata (stan_z_dnia, data_odpisu) - Add migration 037_krs_extended_data.sql Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
30 lines
1.2 KiB
SQL
30 lines
1.2 KiB
SQL
-- ============================================================
|
|
-- 037_krs_extended_data.sql
|
|
-- Rozszerzone dane z KRS API
|
|
-- ============================================================
|
|
|
|
-- Surowe dane z KRS API (JSONB)
|
|
ALTER TABLE companies ADD COLUMN IF NOT EXISTS krs_raw_data JSONB;
|
|
|
|
-- Timestamp ostatniego pobrania z KRS
|
|
ALTER TABLE companies ADD COLUMN IF NOT EXISTS krs_fetched_at TIMESTAMP;
|
|
|
|
-- Data rejestracji w KRS
|
|
ALTER TABLE companies ADD COLUMN IF NOT EXISTS krs_registration_date DATE;
|
|
|
|
-- Sposób reprezentacji
|
|
ALTER TABLE companies ADD COLUMN IF NOT EXISTS krs_representation TEXT;
|
|
|
|
-- Przedmiot działalności z KRS (JSONB array)
|
|
ALTER TABLE companies ADD COLUMN IF NOT EXISTS krs_activities JSONB DEFAULT '[]';
|
|
|
|
-- Komentarze
|
|
COMMENT ON COLUMN companies.krs_raw_data IS 'Pełna odpowiedź z API KRS (JSON)';
|
|
COMMENT ON COLUMN companies.krs_fetched_at IS 'Data ostatniego pobrania danych z KRS';
|
|
COMMENT ON COLUMN companies.krs_registration_date IS 'Data rejestracji w KRS';
|
|
COMMENT ON COLUMN companies.krs_representation IS 'Sposób reprezentacji spółki';
|
|
COMMENT ON COLUMN companies.krs_activities IS 'Przedmiot działalności z KRS jako JSON array';
|
|
|
|
-- Grant permissions
|
|
GRANT ALL ON TABLE companies TO nordabiz_app;
|