Adarsha23 / Adarsha23/petfeeder

[BUG] Schema mismatch - species column not found in pet_profiles

未关闭
#4 0 条评论 0 个 reaction 已指派 1 人 已被 @Adarsha23 认领 在 GitHub 查看
bug Schema
主要语言
JavaScript
星标
1
派生
0
PR 合并指标
30 天内没有已合并 PR

描述

---
## Issue #3: Missing Species Column in Pet Profiles Table
**Description**:
```markdown
## Problem
Frontend service tries to insert `species` column but database schema doesn't have it.
## Error Message
code: "PGRST204" message: "Could not find the 'species' column of 'pet_profiles' in the schema cache"

## Root Cause
The initial migration `001_initial_schema.sql` created `pet_profiles` table without a `species` column, but the frontend service expects it.
## Database Schema (Current)
```sql
CREATE TABLE pet_profiles (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
name VARCHAR(100) NOT NULL,
breed VARCHAR(100),
age INTEGER,
weight DECIMAL(5, 2),
-- Missing: species column
);
Frontend Code (Expects)
species: petData.species || 'Dog',
Steps to Reproduce
Try to create a pet profile
Check browser console
See 400 error about missing column
Solution
Add species column:

ALTER TABLE pet_profiles
ADD COLUMN IF NOT EXISTS species VARCHAR(50) DEFAULT 'Dog'
CHECK (species IN ('Dog', 'Cat'));
Related Files
supabase/migrations/001_initial_schema.sql (line 30-39)
src/services/petProfileService.js (line 53)
supabase/migrations/003_add_missing_policies.sql
Branch
feature/supabase-integration

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。