managarten/apps-archived/maerchenzauber/apps/backend/migrations/simplify_sharing_options.sql
Till-JS 61d181fbc2 chore: archive inactive projects to apps-archived/
Move inactive projects out of active workspace:
- bauntown (community website)
- maerchenzauber (AI story generation)
- memoro (voice memo app)
- news (news aggregation)
- nutriphi (nutrition tracking)
- reader (reading app)
- uload (URL shortener)
- wisekeep (AI wisdom extraction)

Update CLAUDE.md documentation:
- Add presi to active projects
- Document archived projects section
- Update workspace configuration

Archived apps can be re-activated by moving back to apps/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 07:03:59 +01:00

38 lines
No EOL
1.4 KiB
SQL

-- Simplify sharing options by converting 'commons' to 'public'
-- Update any existing 'commons' entries to 'public'
UPDATE characters
SET sharing_preference = 'public'
WHERE sharing_preference = 'commons';
-- Update the constraint to only allow the simplified options
ALTER TABLE characters
DROP CONSTRAINT IF EXISTS characters_sharing_preference_check;
ALTER TABLE characters
ADD CONSTRAINT characters_sharing_preference_check
CHECK (sharing_preference IN ('private', 'link_only', 'public'));
-- Update RLS policies for simplified sharing
DROP POLICY IF EXISTS "View public characters" ON characters;
CREATE POLICY "View public characters" ON characters
FOR SELECT
USING (
(sharing_preference = 'public' AND is_published = true)
OR (sharing_preference = 'link_only' AND is_published = true AND share_code IS NOT NULL)
OR auth.uid()::text = user_id
);
-- Update character_collections to reflect simplified approach
UPDATE character_collections
SET description = 'Die beliebtesten öffentlichen Charaktere'
WHERE id = 'community';
-- Verify the changes
SELECT
COUNT(*) as total,
COUNT(CASE WHEN is_published = true THEN 1 END) as published,
COUNT(CASE WHEN sharing_preference = 'public' THEN 1 END) as public_pref,
COUNT(CASE WHEN sharing_preference = 'private' THEN 1 END) as private_pref,
COUNT(CASE WHEN sharing_preference = 'link_only' THEN 1 END) as link_only_pref
FROM characters;