feat(sql): add SurrealDB schema and taxonomy seed migrations

Add an idempotent SurrealDB 3.x schema for all domain entities with indexes (HNSW vector and full-text), record access and permissions, plus a taxonomy seed with the 8 social challenges, grouped tags and sample locations. Verified on SurrealDB 3.2.4: migrations apply cleanly, re-run is idempotent and CRUD works.
This commit is contained in:
Rafał Tyński
2026-10-04 01:11:33 +02:00
parent 67ec85b6cc
commit 6df1027699
3 changed files with 422 additions and 0 deletions
@@ -0,0 +1,42 @@
-- TarninaHub taxonomy seed — migration 0002
-- Idempotent. Mirrors the 8 social challenges from the ROPS Map of
-- Social Challenges plus grouped tags and a sample of locations.
INSERT IGNORE INTO social_challenge [
{ id: social_challenge:rodzina, name: 'Rodzina i piecza zastępcza', order: 1 },
{ id: social_challenge:bezdomnosc, name: 'Bezdomność', order: 2 },
{ id: social_challenge:niepelnosprawnosc, name: 'Niepełnosprawność', order: 3 },
{ id: social_challenge:ubostwo, name: 'Ubóstwo', order: 4 },
{ id: social_challenge:integracja_cudzoziemcow, name: 'Integracja cudzoziemców', order: 5 },
{ id: social_challenge:zdrowie, name: 'Zdrowie', order: 6 },
{ id: social_challenge:zdrowie_psychiczne, name: 'Zdrowie psychiczne', order: 7 },
{ id: social_challenge:seniorzy, name: 'Seniorzy', order: 8 }
];
INSERT IGNORE INTO tag [
{ id: tag:seniorzy, name: 'seniorzy', group: 'audience' },
{ id: tag:mlodziez, name: 'młodzież', group: 'audience' },
{ id: tag:rodziny, name: 'rodziny', group: 'audience' },
{ id: tag:osoby_z_niepelnosprawnosciami, name: 'osoby z niepełnosprawnościami', group: 'audience' },
{ id: tag:zdrowie_psychiczne, name: 'zdrowie psychiczne', group: 'topic' },
{ id: tag:samotnosc, name: 'samotność', group: 'topic' },
{ id: tag:transport, name: 'transport', group: 'topic' },
{ id: tag:pomysl, name: 'pomysł', group: 'stage' },
{ id: tag:pilotaz, name: 'pilotaż', group: 'stage' },
{ id: tag:skalowanie, name: 'skalowanie', group: 'stage' },
{ id: tag:usluga, name: 'usługa', group: 'stage' },
{ id: tag:ngo, name: 'NGO', group: 'sector' },
{ id: tag:jst, name: 'JST', group: 'sector' },
{ id: tag:instytucja, name: 'instytucja', group: 'sector' },
{ id: tag:firma, name: 'firma', group: 'sector' },
{ id: tag:wykluczenie_cyfrowe, name: 'wykluczenie cyfrowe', group: 'cross' },
{ id: tag:koordynacja_miedzyinstytucjonalna, name: 'koordynacja międzyinstytucjonalna', group: 'cross' },
{ id: tag:dostep_do_uslug, name: 'dostęp do usług', group: 'cross' }
];
INSERT IGNORE INTO location [
{ id: location:malopolska, name: 'Małopolska', kind: 'wojewodztwo', teryt: '12' },
{ id: location:krakow, name: 'Kraków', kind: 'powiat', teryt: '1261' },
{ id: location:tarnow, name: 'Tarnów', kind: 'powiat', teryt: '1263' },
{ id: location:nowy_sacz, name: 'Nowy Sącz', kind: 'powiat', teryt: '1262' }
];