Files
microdao-daarion/migrations/040_microdao_pinned_order.sql

21 lines
1014 B
SQL

-- Migration: Add pinning and ordering for MicroDAO cards
-- Purpose: Allow certain MicroDAOs (platform districts) to be pinned at the top of the list
-- Add pinning columns
ALTER TABLE microdaos
ADD COLUMN IF NOT EXISTS is_pinned boolean DEFAULT false,
ADD COLUMN IF NOT EXISTS pinned_weight integer DEFAULT 0;
-- Create index for efficient sorting
CREATE INDEX IF NOT EXISTS idx_microdaos_pinned ON microdaos (is_pinned DESC, pinned_weight ASC);
-- Set pinned status for the 4 platform districts
UPDATE microdaos SET is_pinned = true, pinned_weight = 1 WHERE slug = 'daarion';
UPDATE microdaos SET is_pinned = true, pinned_weight = 2 WHERE slug = 'energy-union';
UPDATE microdaos SET is_pinned = true, pinned_weight = 3 WHERE slug = 'greenfood';
UPDATE microdaos SET is_pinned = true, pinned_weight = 4 WHERE slug = 'soul-retreat-hub';
-- Also mark these as platforms if not already
UPDATE microdaos SET is_platform = true WHERE slug IN ('daarion', 'energy-union', 'greenfood', 'soul-retreat-hub');