Files
editor/supabase/migrations/20240216000003_create_view_increment_function.sql
T
Aymeric RabotandClaude Opus 4.6 aa27e0dd7a refactor: move supabase config to repo root, fix port and env setup
- Move supabase/ from packages/db/ to repo root for simpler CLI usage
- Use custom ports (553xx) to avoid conflicts with other local Supabase instances
- Add --env-mode=loose to turbo dev so root .env vars reach Next.js
- Remove hardcoded --port 3000 from next dev (reads PORT env var instead)
- Add .env.example with Supabase env var placeholders
- Add supabase local state dirs to .gitignore

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-18 01:48:53 -05:00

10 lines
255 B
PL/PgSQL

-- Function to atomically increment view count
CREATE OR REPLACE FUNCTION increment_property_views(property_id TEXT)
RETURNS void AS $$
BEGIN
UPDATE properties
SET views = views + 1
WHERE id = property_id;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;