Remove FK references to auth.users from init.sql
Build and Push Docker Image / build (push) Successful in 1m55s Details

The auth.users table is created by GoTrue, not the database init.
FK constraints to auth.users fail because init.sql runs before auth starts.
Removed FK from members and audit_logs tables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-01-26 11:58:31 +01:00
parent f599a37964
commit 4039ec8187
1 changed files with 3 additions and 2 deletions

View File

@ -142,8 +142,9 @@ INSERT INTO public.membership_types (name, display_name, annual_dues, descriptio
('honorary', 'Honorary Member', 0.00, 'Granted by the board', false, 5); ('honorary', 'Honorary Member', 0.00, 'Granted by the board', false, 5);
-- MEMBERS TABLE -- MEMBERS TABLE
-- Note: FK to auth.users is added after GoTrue creates the auth schema
CREATE TABLE public.members ( CREATE TABLE public.members (
id UUID PRIMARY KEY REFERENCES auth.users(id) ON DELETE CASCADE, id UUID PRIMARY KEY,
member_id TEXT UNIQUE NOT NULL, member_id TEXT UNIQUE NOT NULL,
first_name TEXT NOT NULL, first_name TEXT NOT NULL,
last_name TEXT NOT NULL, last_name TEXT NOT NULL,
@ -945,7 +946,7 @@ USING (
-- AUDIT LOGS TABLE -- AUDIT LOGS TABLE
CREATE TABLE IF NOT EXISTS audit_logs ( CREATE TABLE IF NOT EXISTS audit_logs (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES auth.users(id) ON DELETE SET NULL, user_id UUID,
user_email TEXT, user_email TEXT,
action TEXT NOT NULL, action TEXT NOT NULL,
resource_type TEXT, resource_type TEXT,