Adarsha23 / Adarsha23/petfeeder

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

Aberta
#4 0 comentários 0 reações 1 responsável Reivindicada por @Adarsha23 Ver no GitHub
bug Schema
Linguagem predominante
JavaScript
Estrelas
1
Forks
0
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

---
## 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

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

Read supabase/migrations/001_initial_schema.sql around lines 30-39 and compare it with src/services/petProfileService.js around line 53; also check supabase/migrations/003_add_missing_policies.sql for related migration context. Reproduce pet-profile creation and confirm the schema-cache error is gone and species accepts the intended default and values.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript, sql, supabase
Domínio
databases
Tipo de issue
Bug
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Claramente especificada
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.