feat: add MicroDAO balance checks and DAARION.city integration
- Update Wallet Service: balance checks (1 DAARION for create, 0.01 for usage) - Update DAOFactory Service: use new balance checks - Add DB migration: teams type field and city_links table - Add DAARION.city seed data - Create teams API routes with balance validation - Add DAARION.city remote repository - Add sync scripts and documentation
This commit is contained in:
50
supabase/migrations/000010_teams_type_and_city_links.sql
Normal file
50
supabase/migrations/000010_teams_type_and_city_links.sql
Normal file
@@ -0,0 +1,50 @@
|
||||
-- 000010_teams_type_and_city_links.sql
|
||||
-- Add type field to teams and city_links table for DAARION.city integration
|
||||
|
||||
-- Up
|
||||
|
||||
-- Add type field to teams table
|
||||
alter table teams
|
||||
add column if not exists type text check (type in ('city', 'platform', 'community', 'guild', 'lab', 'personal'));
|
||||
|
||||
-- Add index for type
|
||||
create index if not exists idx_teams_type on teams(type);
|
||||
|
||||
-- Add parent_team_id for hierarchical structure (DAARION.city -> platforms -> microDAO)
|
||||
alter table teams
|
||||
add column if not exists parent_team_id text references teams(id) on delete set null;
|
||||
|
||||
-- Add index for parent_team_id
|
||||
create index if not exists idx_teams_parent_team_id on teams(parent_team_id);
|
||||
|
||||
-- Create city_links table for explicit relationships
|
||||
create table if not exists city_links (
|
||||
id text primary key,
|
||||
parent_team_id text not null references teams(id) on delete cascade,
|
||||
child_team_id text not null references teams(id) on delete cascade,
|
||||
relation_type text not null check (relation_type in ('platform', 'microdao', 'subdao')),
|
||||
created_at timestamptz not null default now(),
|
||||
unique (parent_team_id, child_team_id)
|
||||
);
|
||||
|
||||
create index if not exists idx_city_links_parent_team_id on city_links(parent_team_id);
|
||||
create index if not exists idx_city_links_child_team_id on city_links(child_team_id);
|
||||
|
||||
-- Insert DAARION.city as first MicroDAO (type='city')
|
||||
insert into teams (id, name, slug, mode, type, parent_team_id, created_at)
|
||||
values (
|
||||
'daarion-city',
|
||||
'DAARION.city',
|
||||
'daarion',
|
||||
'public',
|
||||
'city',
|
||||
null,
|
||||
now()
|
||||
)
|
||||
on conflict (slug) do nothing;
|
||||
|
||||
-- Down
|
||||
drop table if exists city_links cascade;
|
||||
alter table teams drop column if exists parent_team_id;
|
||||
alter table teams drop column if exists type;
|
||||
|
||||
@@ -17,7 +17,8 @@ SQL-міграції для схеми бази даних microDAO/DAARION.city
|
||||
7. `000007_embassy.sql` - Embassy Module (identities, webhooks, oracles)
|
||||
8. `000008_access_keys_capabilities.sql` - Access Keys, Capabilities, Bundles
|
||||
9. `000009_audit_outbox.sql` - Audit Log, Outbox Events
|
||||
10. `seeds.sql` - Seed data для bundles, capabilities та bundle mappings (запускати після всіх міграцій)
|
||||
10. `000010_teams_type_and_city_links.sql` - Teams type field, city_links, DAARION.city seed
|
||||
11. `seeds.sql` - Seed data для bundles, capabilities та bundle mappings (запускати після всіх міграцій)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user