Compare commits

...

3 Commits

Author SHA1 Message Date
Lucas Santana
ba93f3ef29 fix: corrigindo o titulo das historias
Some checks are pending
Docker Build and Push / build (push) Waiting to run
2025-02-01 18:58:42 -03:00
Lucas Santana
fa8073dcee feat: adiciona suporte a múltiplos idiomas na geração de histórias
- Adiciona suporte para Português (Brasil), Inglês (EUA) e Espanhol (Espanha)
- Implementa nova etapa de seleção de idioma no fluxo de criação
- Adiciona instruções específicas por idioma no prompt da IA
- Atualiza CHANGELOG.md para versão 1.3.0
2025-02-01 09:38:59 -03:00
Lucas Santana
45a4b1ba24 docs: adicionando documentação ao projeto 2025-01-31 10:50:48 -03:00
12 changed files with 6375 additions and 118 deletions

View File

@ -5,6 +5,18 @@ Todas as mudanças notáveis neste projeto serão documentadas neste arquivo.
O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/),
e este projeto adere ao [Semantic Versioning](https://semver.org/lang/pt-BR/).
## [0.5.1] - 2024-01-31
### Técnico
- Corrigido erro de constraint na tabela stories ao atualizar status
- Removida tentativa de atualizar coluna inexistente error_message
- Ajustados os status da história para valores válidos: 'pending', 'published', 'failed'
- Melhorada validação e logs durante o processo de geração da história
### Modificado
- Alterado fluxo de status da história para usar estados válidos do banco de dados
- Melhorada mensagem de erro para usuário final em caso de falha na geração
## [1.0.0] - 2024-03-20
### Adicionado
@ -148,3 +160,24 @@ e este projeto adere ao [Semantic Versioning](https://semver.org/lang/pt-BR/).
- Adição de diagramas ER para visualização dos relacionamentos
- Documentação de índices e políticas de segurança
- Inclusão de considerações de performance e backup
## [1.3.0] - 2024-01-31
### Adicionado
- Suporte a múltiplos idiomas na geração de histórias:
- Português (Brasil)
- Inglês (EUA)
- Espanhol (Espanha)
- Nova etapa de seleção de idioma no fluxo de criação de história
- Instruções específicas para cada idioma no prompt da IA
### Modificado
- Fluxo de geração de história para incluir seleção de idioma
- Interface do gerador de histórias com novo passo de idioma
- Adaptação do prompt da IA para considerar o idioma selecionado
### Técnico
- Adicionada constante `LANGUAGE_OPTIONS` com opções de idiomas suportados
- Implementada validação de idioma antes da geração
- Atualizado payload da Edge Function para incluir `language_type`
- Melhorada tipagem para suporte a múltiplos idiomas

302
package-lock.json generated
View File

@ -10,6 +10,11 @@
"dependencies": {
"@ffmpeg/ffmpeg": "^0.12.7",
"@ffmpeg/util": "^0.12.1",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/exporter-metrics-otlp-http": "^0.57.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.57.1",
"@opentelemetry/sdk-metrics": "^1.30.1",
"@opentelemetry/sdk-trace-web": "^1.30.1",
"@radix-ui/react-accordion": "^1.2.2",
"@radix-ui/react-dialog": "^1.1.4",
"@radix-ui/react-progress": "^1.1.1",
@ -1785,6 +1790,209 @@
"integrity": "sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==",
"license": "MIT"
},
"node_modules/@opentelemetry/api": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz",
"integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",
"license": "Apache-2.0",
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@opentelemetry/api-logs": {
"version": "0.57.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.57.1.tgz",
"integrity": "sha512-I4PHczeujhQAQv6ZBzqHYEUiggZL4IdSMixtVD3EYqbdrjujE7kRfI5QohjlPoJm8BvenoW5YaTMWRrbpot6tg==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/api": "^1.3.0"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@opentelemetry/core": {
"version": "1.30.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-1.30.1.tgz",
"integrity": "sha512-OOCM2C/QIURhJMuKaekP3TRBxBKxG/TWWA0TL2J6nXUtDnuCtccy49LUJF8xPFXMX+0LMcxFpCo8M9cGY1W6rQ==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/semantic-conventions": "1.28.0"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0"
}
},
"node_modules/@opentelemetry/exporter-metrics-otlp-http": {
"version": "0.57.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/exporter-metrics-otlp-http/-/exporter-metrics-otlp-http-0.57.1.tgz",
"integrity": "sha512-jpKYVZY7fdwTdy+eAy/Mp9DZMaQpj7caMzlo3QqQDSJx5FZEY6zWzgcKvDvF6h+gdHE7LgUjaPOvJVUs354jJg==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "1.30.1",
"@opentelemetry/otlp-exporter-base": "0.57.1",
"@opentelemetry/otlp-transformer": "0.57.1",
"@opentelemetry/resources": "1.30.1",
"@opentelemetry/sdk-metrics": "1.30.1"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
}
},
"node_modules/@opentelemetry/exporter-trace-otlp-http": {
"version": "0.57.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.57.1.tgz",
"integrity": "sha512-43dLEjlf6JGxpVt9RaRlJAvjHG1wGsbAuNd67RIDy/95zfKk2aNovtiGUgFdS/kcvgvS90upIUbgn0xUd9JjMg==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "1.30.1",
"@opentelemetry/otlp-exporter-base": "0.57.1",
"@opentelemetry/otlp-transformer": "0.57.1",
"@opentelemetry/resources": "1.30.1",
"@opentelemetry/sdk-trace-base": "1.30.1"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
}
},
"node_modules/@opentelemetry/otlp-exporter-base": {
"version": "0.57.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.57.1.tgz",
"integrity": "sha512-GNBJAEYfeiYJQ3O2dvXgiNZ/qjWrBxSb1L1s7iV/jKBRGMN3Nv+miTk2SLeEobF5E5ZK4rVcHKlBZ71bPVIv/g==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "1.30.1",
"@opentelemetry/otlp-transformer": "0.57.1"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
}
},
"node_modules/@opentelemetry/otlp-transformer": {
"version": "0.57.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.57.1.tgz",
"integrity": "sha512-EX67y+ukNNfFrOLyjYGw8AMy0JPIlEX1dW60SGUNZWW2hSQyyolX7EqFuHP5LtXLjJHNfzx5SMBVQ3owaQCNDw==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/api-logs": "0.57.1",
"@opentelemetry/core": "1.30.1",
"@opentelemetry/resources": "1.30.1",
"@opentelemetry/sdk-logs": "0.57.1",
"@opentelemetry/sdk-metrics": "1.30.1",
"@opentelemetry/sdk-trace-base": "1.30.1",
"protobufjs": "^7.3.0"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": "^1.3.0"
}
},
"node_modules/@opentelemetry/resources": {
"version": "1.30.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-1.30.1.tgz",
"integrity": "sha512-5UxZqiAgLYGFjS4s9qm5mBVo433u+dSPUFWVWXmLAD4wB65oMCoXaJP1KJa9DIYYMeHu3z4BZcStG3LC593cWA==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "1.30.1",
"@opentelemetry/semantic-conventions": "1.28.0"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0"
}
},
"node_modules/@opentelemetry/sdk-logs": {
"version": "0.57.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.57.1.tgz",
"integrity": "sha512-jGdObb/BGWu6Peo3cL3skx/Rl1Ak/wDDO3vpPrrThGbqE7isvkCsX6uE+OAt8Ayjm9YC8UGkohWbLR09JmM0FA==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/api-logs": "0.57.1",
"@opentelemetry/core": "1.30.1",
"@opentelemetry/resources": "1.30.1"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": ">=1.4.0 <1.10.0"
}
},
"node_modules/@opentelemetry/sdk-metrics": {
"version": "1.30.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-1.30.1.tgz",
"integrity": "sha512-q9zcZ0Okl8jRgmy7eNW3Ku1XSgg3sDLa5evHZpCwjspw7E8Is4K/haRPDJrBcX3YSn/Y7gUvFnByNYEKQNbNog==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "1.30.1",
"@opentelemetry/resources": "1.30.1"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": ">=1.3.0 <1.10.0"
}
},
"node_modules/@opentelemetry/sdk-trace-base": {
"version": "1.30.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.30.1.tgz",
"integrity": "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "1.30.1",
"@opentelemetry/resources": "1.30.1",
"@opentelemetry/semantic-conventions": "1.28.0"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0"
}
},
"node_modules/@opentelemetry/sdk-trace-web": {
"version": "1.30.1",
"resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-web/-/sdk-trace-web-1.30.1.tgz",
"integrity": "sha512-AUo2e+1uyTGMB36VlbvBqnCogVzQhpC7dRcVVdCrt+cFHLpFRRJcd45J2obGTgs0XiAwNLyq5bhkW3JF2NZA+A==",
"license": "Apache-2.0",
"dependencies": {
"@opentelemetry/core": "1.30.1",
"@opentelemetry/sdk-trace-base": "1.30.1",
"@opentelemetry/semantic-conventions": "1.28.0"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"@opentelemetry/api": ">=1.0.0 <1.10.0"
}
},
"node_modules/@opentelemetry/semantic-conventions": {
"version": "1.28.0",
"resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz",
"integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==",
"license": "Apache-2.0",
"engines": {
"node": ">=14"
}
},
"node_modules/@pkgjs/parseargs": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
@ -1794,6 +2002,70 @@
"node": ">=14"
}
},
"node_modules/@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
"integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/base64": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/codegen": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/eventemitter": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
"integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==",
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/fetch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
"license": "BSD-3-Clause",
"dependencies": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
}
},
"node_modules/@protobufjs/float": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
"integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/inquire": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
"integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==",
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/path": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
"integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/pool": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
"integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
"license": "BSD-3-Clause"
},
"node_modules/@protobufjs/utf8": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",
"license": "BSD-3-Clause"
},
"node_modules/@radix-ui/primitive": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.1.tgz",
@ -6648,6 +6920,12 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/long": {
"version": "5.2.4",
"resolved": "https://registry.npmjs.org/long/-/long-5.2.4.tgz",
"integrity": "sha512-qtzLbJE8hq7VabR3mISmVGtoXP8KGc2Z/AT8OuqlYD7JTR3oqrgwdjnk07wpj1twXxYmgDXgoKVWUG/fReSzHg==",
"license": "Apache-2.0"
},
"node_modules/loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -7570,6 +7848,30 @@
"integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==",
"license": "ISC"
},
"node_modules/protobufjs": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz",
"integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==",
"hasInstallScript": true,
"license": "BSD-3-Clause",
"dependencies": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
"@protobufjs/codegen": "^2.0.4",
"@protobufjs/eventemitter": "^1.1.0",
"@protobufjs/fetch": "^1.1.0",
"@protobufjs/float": "^1.0.2",
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
"@types/node": ">=13.7.0",
"long": "^5.0.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",

View File

@ -17,6 +17,11 @@
"dependencies": {
"@ffmpeg/ffmpeg": "^0.12.7",
"@ffmpeg/util": "^0.12.1",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/exporter-metrics-otlp-http": "^0.57.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.57.1",
"@opentelemetry/sdk-metrics": "^1.30.1",
"@opentelemetry/sdk-trace-web": "^1.30.1",
"@radix-ui/react-accordion": "^1.2.2",
"@radix-ui/react-dialog": "^1.1.4",
"@radix-ui/react-progress": "^1.1.1",

View File

@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom';
import { supabase } from '../../lib/supabase';
import { useSession } from '../../hooks/useSession';
import { useStoryCategories } from '../../hooks/useStoryCategories';
import { Wand2, ArrowLeft } from 'lucide-react';
import { Wand2, ArrowLeft, Globe } from 'lucide-react';
import { useStudentTracking } from '../../hooks/useStudentTracking';
interface Category {
@ -19,6 +19,7 @@ interface StoryStep {
key?: keyof StoryChoices;
items?: Category[];
isContextStep?: boolean;
isLanguageStep?: boolean;
}
export interface StoryChoices {
@ -27,6 +28,7 @@ export interface StoryChoices {
character_id: string | null;
setting_id: string | null;
context?: string;
language_type: string;
}
interface StoryGeneratorProps {
@ -42,6 +44,12 @@ interface StoryGeneratorProps {
setChoices: React.Dispatch<React.SetStateAction<StoryChoices>>;
}
const LANGUAGE_OPTIONS = [
{ value: 'pt-BR', label: 'Português (Brasil)' },
{ value: 'en-US', label: 'Inglês (EUA)' },
{ value: 'es-ES', label: 'Espanhol (Espanha)' }
] as const;
export function StoryGenerator({
initialContext = '',
onContextChange,
@ -54,10 +62,9 @@ export function StoryGenerator({
choices,
setChoices
}: StoryGeneratorProps) {
// 1. Obter dados da API
const { themes, subjects, characters, settings, isLoading } = useStoryCategories();
// 2. Definir steps com os dados obtidos
// Definir steps com os dados obtidos
const steps: StoryStep[] = [
{
title: 'Escolha o Tema',
@ -79,31 +86,51 @@ export function StoryGenerator({
items: settings || [],
key: 'setting_id'
},
{
title: 'Escolha o Idioma da História',
isLanguageStep: true
},
{
title: 'Contexto da História (Opcional)',
isContextStep: true
}
];
// 3. useEffect que depende dos dados
// useEffect que depende dos dados
React.useEffect(() => {
if (inputMode === 'voice' && voiceTranscript && themes) {
setStep(steps.length);
// Só aplicar escolhas aleatórias se estiver no modo voz
if (inputMode === 'voice' && voiceTranscript && themes && !choices.theme_id) {
setStep(steps.length); // Vai para o último passo (contexto)
// Selecionar IDs aleatórios válidos para cada categoria
const randomTheme = themes[Math.floor(Math.random() * themes.length)];
const randomSubject = subjects?.[Math.floor(Math.random() * (subjects?.length || 1))] || null;
const randomCharacter = characters?.[Math.floor(Math.random() * (characters?.length || 1))] || null;
const randomSetting = settings?.[Math.floor(Math.random() * (settings?.length || 1))] || null;
setChoices(prev => ({
...prev,
theme_id: 'auto',
subject_id: 'auto',
character_id: 'auto',
setting_id: 'auto'
theme_id: randomTheme?.id || null,
subject_id: randomSubject?.id || null,
character_id: randomCharacter?.id || null,
setting_id: randomSetting?.id || null,
language_type: prev.language_type // Mantém o idioma selecionado
}));
}
}, [inputMode, voiceTranscript, steps.length, themes, setStep, setChoices]);
}, [inputMode, voiceTranscript, themes, subjects, characters, settings, setStep, setChoices, choices.theme_id]);
// Atualizar apenas o contexto quando mudar o modo ou a transcrição
React.useEffect(() => {
setChoices(prev => ({
...prev,
context: inputMode === 'voice' ? voiceTranscript : initialContext
}));
if (inputMode === 'voice' && voiceTranscript) {
setChoices(prev => ({
...prev,
context: voiceTranscript
}));
} else if (inputMode === 'form') {
setChoices(prev => ({
...prev,
context: initialContext
}));
}
}, [voiceTranscript, initialContext, inputMode]);
const handleContextChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
@ -120,10 +147,43 @@ export function StoryGenerator({
const startTime = React.useRef(Date.now());
const currentStep = steps[step - 1];
const isLastStep = step === steps.length;
const handleSelect = (key: keyof StoryChoices, value: string) => {
console.log(`Selecionando ${key}:`, value); // Log para debug
if (!value) {
setError(`Valor inválido para ${key}`);
return;
}
setChoices(prev => ({ ...prev, [key]: value }));
// Avançar apenas se houver um próximo passo
if (step < steps.length) {
setStep((prev: number) => prev + 1);
}
};
const handleNext = () => {
if (currentStep.isContextStep) {
setStep((prev: number) => prev + 1);
}
};
const handleLanguageSelect = (language: string) => {
console.log('Selecionando idioma:', language);
if (!LANGUAGE_OPTIONS.some(opt => opt.value === language)) {
setError('Idioma inválido selecionado');
return;
}
setChoices(prev => ({
...prev,
language_type: language
}));
// Avançar para o próximo passo
if (step < steps.length) {
setStep((prev: number) => prev + 1);
}
@ -139,38 +199,115 @@ export function StoryGenerator({
// Contexto é opcional no formulário
const finalContext = inputMode === 'voice' ? voiceTranscript : initialContext;
if (!session?.user?.id) return;
if (!choices.theme_id || !choices.subject_id || !choices.character_id || !choices.setting_id) {
setError('Por favor, preencha todas as escolhas antes de continuar.');
if (!session?.user?.id) {
setError('Usuário não autenticado');
return;
}
// Log inicial para debug
console.log('=== Iniciando geração de história ===');
console.log('Modo:', inputMode);
console.log('Choices:', choices);
// Validações iniciais
if (!themes?.length || !subjects?.length || !characters?.length || !settings?.length) {
console.error('Dados das categorias não carregados:', { themes, subjects, characters, settings });
setError('Erro ao carregar dados necessários. Tente novamente.');
return;
}
// Validar se todos os IDs são UUIDs válidos
const isValidUUID = (id: string | null) => {
if (!id) return false;
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
return uuidRegex.test(id);
};
// Validar cada ID individualmente
const validations = [
{ field: 'theme_id', value: choices.theme_id, exists: themes.some(t => t.id === choices.theme_id) },
{ field: 'subject_id', value: choices.subject_id, exists: subjects.some(s => s.id === choices.subject_id) },
{ field: 'character_id', value: choices.character_id, exists: characters.some(c => c.id === choices.character_id) },
{ field: 'setting_id', value: choices.setting_id, exists: settings.some(s => s.id === choices.setting_id) }
];
// Verificar cada validação
for (const validation of validations) {
console.log(`Validando ${validation.field}:`, validation);
if (!validation.value) {
setError(`${validation.field} não selecionado`);
return;
}
if (!isValidUUID(validation.value)) {
setError(`${validation.field} não é um UUID válido`);
return;
}
if (!validation.exists) {
setError(`${validation.field} não encontrado na lista de opções`);
return;
}
}
// Validar idioma
if (!choices.language_type || !LANGUAGE_OPTIONS.some(opt => opt.value === choices.language_type)) {
setError('Idioma não selecionado ou inválido');
return;
}
try {
setIsGenerating(true);
setError(null);
setGenerationStatus('creating');
// Log detalhado antes de fazer a inserção
console.log('=== Dados validados para inserção ===', {
student_id: session.user.id,
theme_id: choices.theme_id,
subject_id: choices.subject_id,
character_id: choices.character_id,
setting_id: choices.setting_id,
context: finalContext,
language_type: choices.language_type
});
// Criar objeto da história antes da inserção para validação
const storyData = {
student_id: session.user.id,
title: 'Gerando...',
theme_id: choices.theme_id,
subject_id: choices.subject_id,
character_id: choices.character_id,
setting_id: choices.setting_id,
context: finalContext,
language_type: choices.language_type,
status: 'draft',
content: {
prompt: choices,
pages: []
}
} as const;
// Validar se todos os campos necessários estão presentes
const requiredFields = ['student_id', 'theme_id', 'subject_id', 'character_id', 'setting_id', 'language_type'] as const;
const missingFields = requiredFields.filter(field => !storyData[field]);
if (missingFields.length > 0) {
throw new Error(`Campos obrigatórios faltando: ${missingFields.join(', ')}`);
}
const { data: story, error: storyError } = await supabase
.from('stories')
.insert({
student_id: session.user.id,
title: 'Gerando...',
theme_id: choices.theme_id,
subject_id: choices.subject_id,
character_id: choices.character_id,
setting_id: choices.setting_id,
context: finalContext,
status: 'draft',
content: {
prompt: choices,
pages: []
}
})
.insert(storyData)
.select()
.single();
if (storyError) throw storyError;
if (storyError) {
console.error('Erro ao inserir história:', storyError);
throw storyError;
}
// Tracking da criação da história
const selectedTheme = themes?.find(t => t.id === choices.theme_id)?.title || '';
@ -186,24 +323,102 @@ export function StoryGenerator({
setting: selectedSetting,
context: finalContext,
generation_time: Date.now() - startTime.current,
word_count: 0, // será atualizado após a geração
word_count: 0,
student_id: session.user.id,
school_id: session.user.user_metadata?.school_id,
class_id: session.user.user_metadata?.class_id
});
setGenerationStatus('generating-images');
console.log('Chamando Edge Function com:', story);
console.log('=== Chamando Edge Function ===');
console.log('Story ID:', story.id);
console.log('Story Data:', story);
const { data: functionData, error: functionError } = await supabase.functions
.invoke('generate-story', {
body: { record: story }
});
try {
if (!story?.id) {
throw new Error('ID da história não encontrado');
}
console.log('Resposta da Edge Function:', functionData);
const storyPayload = {
voice_context: finalContext || '',
student_id: session.user.id,
theme_id: choices.theme_id,
subject_id: choices.subject_id,
character_id: choices.character_id,
setting_id: choices.setting_id,
language_type: choices.language_type,
theme: selectedTheme,
subject: selectedSubject,
character: selectedCharacter,
setting: selectedSetting,
story_id: story.id // Garantindo que o ID existe
};
if (functionError) {
throw new Error(`Erro na Edge Function: ${functionError.message}`);
console.log('=== Dados da História ===');
console.log('ID:', story.id);
console.log('Payload completo:', storyPayload);
const response = await supabase.functions
.invoke('generate-story', {
body: storyPayload
});
console.log('=== Resposta da Edge Function ===');
console.log('Resposta completa:', response);
// Se a resposta não for 200, lançar erro
if (response.error) {
console.error('Erro na Edge Function:', response.error);
throw new Error(`Erro na Edge Function: ${response.error.message}`);
}
// Se não houver dados na resposta
if (!response.data) {
console.error('Edge Function não retornou dados');
throw new Error('Edge Function não retornou dados');
}
// Atualizar o status da história para success
const { error: updateError } = await supabase
.from('stories')
.update({
status: 'published',
updated_at: new Date().toISOString()
})
.eq('id', story.id)
.single();
if (updateError) {
console.error('Erro ao atualizar status da história:', updateError);
throw updateError;
}
} catch (error) {
console.error('=== Erro na Edge Function ===');
console.error('Erro completo:', error);
console.error('Story ID:', story?.id);
console.error('Estado atual:', { choices, inputMode, step });
if (!story?.id) {
throw new Error('ID da história não encontrado para atualizar status de erro');
}
// Atualizar status da história para erro
const { error: updateError } = await supabase
.from('stories')
.update({
status: 'failed',
title: 'Erro na Geração',
updated_at: new Date().toISOString()
})
.eq('id', story.id)
.single();
if (updateError) {
console.error('Erro ao atualizar status de erro:', updateError);
}
throw new Error(`Erro na geração da história. Por favor, tente novamente.`);
}
setGenerationStatus('saving');
@ -213,7 +428,10 @@ export function StoryGenerator({
.eq('id', story.id)
.single();
if (updateError) throw updateError;
if (updateError) {
console.error('Erro ao buscar história atualizada:', updateError);
throw updateError;
}
// Atualizar a contagem de palavras após a geração
const wordCount = updatedStory.content.pages.reduce((acc: number, page: { text: string }) =>
@ -227,8 +445,15 @@ export function StoryGenerator({
navigate(`/aluno/historias/${story.id}`);
} catch (err) {
console.error('Erro ao gerar história:', err);
setError('Não foi possível criar sua história. Tente novamente.');
console.error('=== Erro detalhado ===');
console.error('Erro:', err);
console.error('Estado atual:', { choices, inputMode, step });
if (err instanceof Error) {
setError(`Erro ao gerar história: ${err.message}`);
} else {
setError('Erro desconhecido ao gerar história. Tente novamente.');
}
} finally {
setIsGenerating(false);
setGenerationStatus('idle');
@ -279,7 +504,31 @@ export function StoryGenerator({
{currentStep.title}
</h2>
{currentStep.isContextStep ? (
{currentStep.isLanguageStep ? (
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{LANGUAGE_OPTIONS.map((option) => (
<button
key={option.value}
onClick={() => handleLanguageSelect(option.value)}
className={`p-6 rounded-xl border-2 transition-all text-left ${
choices.language_type === option.value
? 'border-purple-500 bg-purple-50'
: 'border-gray-200 hover:border-purple-200 hover:bg-gray-50'
}`}
>
<div className="flex items-center gap-3">
<Globe className="h-6 w-6 text-purple-600" />
<div>
<h3 className="font-medium text-gray-900">{option.label}</h3>
<p className="text-sm text-gray-600">
Escreva sua história em {option.label}
</p>
</div>
</div>
</button>
))}
</div>
) : currentStep.isContextStep ? (
<div className="space-y-4">
<textarea
value={initialContext}
@ -287,6 +536,14 @@ export function StoryGenerator({
className="w-full p-3 border rounded-lg"
placeholder="Descreva sua história... (opcional)"
/>
<button
onClick={handleGenerate}
disabled={isGenerating}
className="w-full flex items-center justify-center gap-2 px-6 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50"
>
<Wand2 className="h-5 w-5" />
{isGenerating ? getGenerationStatusText() : 'Criar História Mágica'}
</button>
</div>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
@ -335,14 +592,13 @@ export function StoryGenerator({
Voltar
</button>
{isLastStep && (
{!currentStep.isLanguageStep && !currentStep.isContextStep && (
<button
onClick={handleGenerate}
disabled={!choices.theme_id || !choices.subject_id || !choices.character_id || !choices.setting_id || isGenerating}
onClick={handleNext}
disabled={currentStep.key && !choices[currentStep.key] || isGenerating}
className="flex items-center gap-2 px-6 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50"
>
<Wand2 className="h-5 w-5" />
{isGenerating ? getGenerationStatusText() : 'Criar História Mágica'}
Próximo
</button>
)}
</div>

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import { ArrowLeft, Sparkles } from 'lucide-react';
import { ArrowLeft, Sparkles, Globe } from 'lucide-react';
import { useNavigate } from 'react-router-dom';
import { StoryGenerator } from '../../components/story/StoryGenerator';
import { useSession } from '../../hooks/useSession';
@ -10,6 +10,12 @@ import { useSpeechRecognition } from '@/features/voice-commands/hooks/useSpeechR
import { VoiceCommandButton } from '@/features/voice-commands/components/VoiceCommandButton';
import type { StoryChoices } from '@/components/story/StoryGenerator';
const LANGUAGE_OPTIONS = [
{ value: 'pt-BR', label: 'Português (Brasil)' },
{ value: 'en-US', label: 'Inglês (EUA)' },
{ value: 'es-ES', label: 'Espanhol (Espanha)' }
] as const;
export function CreateStoryPage() {
const navigate = useNavigate();
const { session } = useSession();
@ -38,7 +44,8 @@ export function CreateStoryPage() {
subject_id: null,
character_id: null,
setting_id: null,
context: ''
context: '',
language_type: 'pt-BR'
});
// Manipuladores para gravação de voz

View File

@ -0,0 +1,410 @@
| table_schema | table_name | column_name | constraint_type |
| ------------------- | ------------------------------- | --------------------- | --------------- |
| public | story_exercise_words | id | PRIMARY KEY |
| public | story_exercise_words | story_id | FOREIGN KEY |
| public | story_exercise_words | story_id | UNIQUE |
| public | story_exercise_words | word | UNIQUE |
| public | story_exercise_words | exercise_type | UNIQUE |
| public | story_exercise_words | | CHECK |
| public | story_pages | story_id | FOREIGN KEY |
| public | story_pages | story_id | FOREIGN KEY |
| public | story_pages | id | PRIMARY KEY |
| public | story_generations | id | PRIMARY KEY |
| public | story_generations | story_id | FOREIGN KEY |
| public | schools | id | PRIMARY KEY |
| public | teachers | email | UNIQUE |
| public | teachers | id | PRIMARY KEY |
| public | teachers | school_id | FOREIGN KEY |
| public | teachers | | CHECK |
| public | classes | id | PRIMARY KEY |
| public | classes | school_id | FOREIGN KEY |
| public | classes | teacher_id | FOREIGN KEY |
| public | teacher_classes | class_id | FOREIGN KEY |
| public | teacher_classes | id | PRIMARY KEY |
| public | teacher_classes | teacher_id | UNIQUE |
| public | teacher_classes | class_id | UNIQUE |
| public | teacher_classes | teacher_id | FOREIGN KEY |
| public | students | class_id | FOREIGN KEY |
| public | students | email | UNIQUE |
| public | students | id | PRIMARY KEY |
| public | students | school_id | FOREIGN KEY |
| public | students | | CHECK |
| public | story_themes | id | PRIMARY KEY |
| public | story_themes | slug | UNIQUE |
| public | story_subjects | id | PRIMARY KEY |
| public | story_subjects | slug | UNIQUE |
| public | story_characters | id | PRIMARY KEY |
| public | story_characters | slug | UNIQUE |
| public | story_settings | id | PRIMARY KEY |
| public | story_settings | slug | UNIQUE |
| public | stories | character_id | FOREIGN KEY |
| public | stories | setting_id | FOREIGN KEY |
| public | stories | subject_id | FOREIGN KEY |
| public | stories | theme_id | FOREIGN KEY |
| public | stories | character_id | FOREIGN KEY |
| public | stories | id | PRIMARY KEY |
| public | stories | setting_id | FOREIGN KEY |
| public | stories | | CHECK |
| public | stories | student_id | FOREIGN KEY |
| public | stories | subject_id | FOREIGN KEY |
| public | stories | theme_id | FOREIGN KEY |
| public | teacher_invites | id | PRIMARY KEY |
| public | teacher_invites | school_id | FOREIGN KEY |
| public | teacher_invites | | CHECK |
| public | teacher_invites | token | UNIQUE |
| public | phonics_exercise_types | id | PRIMARY KEY |
| public | phonics_exercises | id | PRIMARY KEY |
| public | phonics_exercises | type_id | FOREIGN KEY |
| public | phonics_words | id | PRIMARY KEY |
| public | phonics_exercise_words | exercise_id | FOREIGN KEY |
| public | phonics_exercise_words | exercise_id | UNIQUE |
| public | phonics_exercise_words | word_id | UNIQUE |
| public | phonics_exercise_words | id | PRIMARY KEY |
| public | phonics_exercise_words | word_id | FOREIGN KEY |
| public | phonics_categories | id | PRIMARY KEY |
| public | phonics_exercise_media | exercise_id | FOREIGN KEY |
| public | phonics_exercise_media | media_type_id | FOREIGN KEY |
| public | phonics_exercise_media | id | PRIMARY KEY |
| public | student_phonics_attempt_answers | attempt_id | FOREIGN KEY |
| public | student_phonics_attempt_answers | id | PRIMARY KEY |
| public | student_phonics_attempt_answers | word_id | FOREIGN KEY |
| public | media_types | id | PRIMARY KEY |
| public | student_phonics_progress | exercise_id | FOREIGN KEY |
| public | student_phonics_progress | id | PRIMARY KEY |
| public | student_phonics_progress | student_id | UNIQUE |
| public | student_phonics_progress | exercise_id | UNIQUE |
| public | student_phonics_progress | student_id | FOREIGN KEY |
| public | student_phonics_attempts | exercise_id | FOREIGN KEY |
| public | student_phonics_attempts | id | PRIMARY KEY |
| public | student_phonics_attempts | student_id | FOREIGN KEY |
| public | achievement_types | id | PRIMARY KEY |
| public | phonics_achievements | id | PRIMARY KEY |
| public | phonics_achievements | type_id | FOREIGN KEY |
| public | student_phonics_achievements | achievement_id | FOREIGN KEY |
| public | student_phonics_achievements | id | PRIMARY KEY |
| public | student_phonics_achievements | student_id | UNIQUE |
| public | student_phonics_achievements | achievement_id | UNIQUE |
| public | student_phonics_achievements | student_id | FOREIGN KEY |
| public | phonics_word_audio | id | PRIMARY KEY |
| public | phonics_word_audio | word | UNIQUE |
| public | story_recordings | story_id | FOREIGN KEY |
| public | story_recordings | story_id | FOREIGN KEY |
| public | story_recordings | | CHECK |
| public | story_recordings | | CHECK |
| public | story_recordings | | CHECK |
| public | story_recordings | id | PRIMARY KEY |
| public | story_recordings | | CHECK |
| public | story_recordings | student_id | FOREIGN KEY |
| public | interests | id | PRIMARY KEY |
| public | interests | student_id | UNIQUE |
| public | interests | category | UNIQUE |
| public | interests | item | UNIQUE |
| public | interests | student_id | FOREIGN KEY |
| public | achievements | id | PRIMARY KEY |
| public | student_achievements_old | achievement_id | FOREIGN KEY |
| public | student_achievements_old | id | PRIMARY KEY |
| public | student_achievements_old | student_id | FOREIGN KEY |
| public | student_achievements | achievement_id | FOREIGN KEY |
| public | student_achievements | id | PRIMARY KEY |
| public | student_achievements | student_id | FOREIGN KEY |
| storage | buckets | id | PRIMARY KEY |
| storage | migrations | name | UNIQUE |
| storage | migrations | id | PRIMARY KEY |
| storage | objects | bucket_id | FOREIGN KEY |
| storage | objects | id | PRIMARY KEY |
| storage | s3_multipart_uploads | bucket_id | FOREIGN KEY |
| storage | s3_multipart_uploads | id | PRIMARY KEY |
| storage | s3_multipart_uploads_parts | bucket_id | FOREIGN KEY |
| storage | s3_multipart_uploads_parts | id | PRIMARY KEY |
| storage | s3_multipart_uploads_parts | upload_id | FOREIGN KEY |
| auth | refresh_tokens | id | PRIMARY KEY |
| auth | refresh_tokens | session_id | FOREIGN KEY |
| auth | refresh_tokens | token | UNIQUE |
| auth | instances | id | PRIMARY KEY |
| auth | schema_migrations | version | PRIMARY KEY |
| auth | users | | CHECK |
| auth | users | phone | UNIQUE |
| auth | users | id | PRIMARY KEY |
| auth | sso_providers | | CHECK |
| auth | sso_providers | id | PRIMARY KEY |
| auth | saml_relay_states | | CHECK |
| auth | saml_relay_states | flow_state_id | FOREIGN KEY |
| auth | saml_relay_states | id | PRIMARY KEY |
| auth | saml_relay_states | sso_provider_id | FOREIGN KEY |
| auth | flow_state | id | PRIMARY KEY |
| auth | one_time_tokens | id | PRIMARY KEY |
| auth | one_time_tokens | | CHECK |
| auth | one_time_tokens | user_id | FOREIGN KEY |
| auth | audit_log_entries | id | PRIMARY KEY |
| auth | mfa_factors | last_challenged_at | UNIQUE |
| auth | mfa_factors | id | PRIMARY KEY |
| auth | mfa_factors | user_id | FOREIGN KEY |
| auth | sessions | id | PRIMARY KEY |
| auth | sessions | user_id | FOREIGN KEY |
| auth | sso_domains | | CHECK |
| auth | sso_domains | id | PRIMARY KEY |
| auth | sso_domains | sso_provider_id | FOREIGN KEY |
| auth | mfa_challenges | factor_id | FOREIGN KEY |
| auth | mfa_challenges | id | PRIMARY KEY |
| auth | mfa_amr_claims | id | PRIMARY KEY |
| auth | mfa_amr_claims | session_id | UNIQUE |
| auth | mfa_amr_claims | authentication_method | UNIQUE |
| auth | mfa_amr_claims | session_id | FOREIGN KEY |
| auth | saml_providers | | CHECK |
| auth | saml_providers | | CHECK |
| auth | saml_providers | | CHECK |
| auth | saml_providers | entity_id | UNIQUE |
| auth | saml_providers | id | PRIMARY KEY |
| auth | saml_providers | sso_provider_id | FOREIGN KEY |
| auth | identities | id | PRIMARY KEY |
| auth | identities | provider | UNIQUE |
| auth | identities | provider_id | UNIQUE |
| auth | identities | user_id | FOREIGN KEY |
| realtime | schema_migrations | version | PRIMARY KEY |
| realtime | subscription | id | PRIMARY KEY |
| realtime | messages | id | PRIMARY KEY |
| realtime | messages | inserted_at | PRIMARY KEY |
| pgsodium | key | | CHECK |
| pgsodium | key | parent_key | FOREIGN KEY |
| pgsodium | key | id | PRIMARY KEY |
| pgsodium | key | name | UNIQUE |
| pgsodium | key | | CHECK |
| vault | secrets | key_id | FOREIGN KEY |
| vault | secrets | id | PRIMARY KEY |
| supabase_migrations | schema_migrations | version | PRIMARY KEY |
| supabase_migrations | seed_files | path | PRIMARY KEY |
| public | story_exercise_words | | CHECK |
| public | story_exercise_words | | CHECK |
| public | story_exercise_words | | CHECK |
| public | story_pages | | CHECK |
| public | story_pages | | CHECK |
| public | story_pages | | CHECK |
| public | story_pages | | CHECK |
| public | story_pages | | CHECK |
| public | story_generations | | CHECK |
| public | story_generations | | CHECK |
| public | story_generations | | CHECK |
| public | story_generations | | CHECK |
| public | story_generations | | CHECK |
| public | story_generations | | CHECK |
| public | schools | | CHECK |
| public | schools | | CHECK |
| public | schools | | CHECK |
| public | schools | | CHECK |
| public | schools | | CHECK |
| public | teachers | | CHECK |
| public | teachers | | CHECK |
| public | teachers | | CHECK |
| public | teachers | | CHECK |
| public | teachers | | CHECK |
| public | teachers | | CHECK |
| public | classes | | CHECK |
| public | classes | | CHECK |
| public | classes | | CHECK |
| public | classes | | CHECK |
| public | classes | | CHECK |
| public | classes | | CHECK |
| public | classes | | CHECK |
| public | teacher_classes | | CHECK |
| public | teacher_classes | | CHECK |
| public | teacher_classes | | CHECK |
| public | teacher_classes | | CHECK |
| public | students | | CHECK |
| public | students | | CHECK |
| public | students | | CHECK |
| public | students | | CHECK |
| public | students | | CHECK |
| public | students | | CHECK |
| public | students | | CHECK |
| public | students | | CHECK |
| public | story_themes | | CHECK |
| public | story_themes | | CHECK |
| public | story_themes | | CHECK |
| public | story_themes | | CHECK |
| public | story_themes | | CHECK |
| public | story_themes | | CHECK |
| public | story_themes | | CHECK |
| public | story_subjects | | CHECK |
| public | story_subjects | | CHECK |
| public | story_subjects | | CHECK |
| public | story_subjects | | CHECK |
| public | story_subjects | | CHECK |
| public | story_subjects | | CHECK |
| public | story_subjects | | CHECK |
| public | story_characters | | CHECK |
| public | story_characters | | CHECK |
| public | story_characters | | CHECK |
| public | story_characters | | CHECK |
| public | story_characters | | CHECK |
| public | story_characters | | CHECK |
| public | story_characters | | CHECK |
| public | story_settings | | CHECK |
| public | story_settings | | CHECK |
| public | story_settings | | CHECK |
| public | story_settings | | CHECK |
| public | story_settings | | CHECK |
| public | story_settings | | CHECK |
| public | story_settings | | CHECK |
| public | stories | | CHECK |
| public | stories | | CHECK |
| public | stories | | CHECK |
| public | stories | | CHECK |
| public | stories | | CHECK |
| public | stories | | CHECK |
| public | stories | | CHECK |
| public | teacher_invites | | CHECK |
| public | teacher_invites | | CHECK |
| public | teacher_invites | | CHECK |
| public | teacher_invites | | CHECK |
| public | teacher_invites | | CHECK |
| public | teacher_invites | | CHECK |
| public | teacher_invites | | CHECK |
| public | phonics_exercise_types | | CHECK |
| public | phonics_exercise_types | | CHECK |
| public | phonics_exercises | | CHECK |
| public | phonics_exercises | | CHECK |
| public | phonics_exercises | | CHECK |
| public | phonics_exercises | | CHECK |
| public | phonics_words | | CHECK |
| public | phonics_words | | CHECK |
| public | phonics_words | | CHECK |
| public | phonics_exercise_words | | CHECK |
| public | phonics_categories | | CHECK |
| public | phonics_categories | | CHECK |
| public | phonics_categories | | CHECK |
| public | phonics_categories | | CHECK |
| public | phonics_exercise_media | | CHECK |
| public | phonics_exercise_media | | CHECK |
| public | student_phonics_attempt_answers | | CHECK |
| public | student_phonics_attempt_answers | | CHECK |
| public | media_types | | CHECK |
| public | media_types | | CHECK |
| public | student_phonics_progress | | CHECK |
| public | student_phonics_attempts | | CHECK |
| public | student_phonics_attempts | | CHECK |
| public | achievement_types | | CHECK |
| public | achievement_types | | CHECK |
| public | phonics_achievements | | CHECK |
| public | phonics_achievements | | CHECK |
| public | student_phonics_achievements | | CHECK |
| public | phonics_word_audio | | CHECK |
| public | phonics_word_audio | | CHECK |
| public | phonics_word_audio | | CHECK |
| public | phonics_word_audio | | CHECK |
| public | story_recordings | | CHECK |
| public | story_recordings | | CHECK |
| public | story_recordings | | CHECK |
| public | interests | | CHECK |
| public | interests | | CHECK |
| public | interests | | CHECK |
| public | interests | | CHECK |
| public | interests | | CHECK |
| public | interests | | CHECK |
| public | achievements | | CHECK |
| public | student_achievements_old | | CHECK |
| public | student_achievements | | CHECK |
| storage | buckets | | CHECK |
| storage | buckets | | CHECK |
| storage | migrations | | CHECK |
| storage | migrations | | CHECK |
| storage | migrations | | CHECK |
| storage | objects | | CHECK |
| storage | s3_multipart_uploads | | CHECK |
| storage | s3_multipart_uploads | | CHECK |
| storage | s3_multipart_uploads | | CHECK |
| storage | s3_multipart_uploads | | CHECK |
| storage | s3_multipart_uploads | | CHECK |
| storage | s3_multipart_uploads | | CHECK |
| storage | s3_multipart_uploads | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| storage | s3_multipart_uploads_parts | | CHECK |
| auth | refresh_tokens | | CHECK |
| auth | instances | | CHECK |
| auth | schema_migrations | | CHECK |
| auth | users | | CHECK |
| auth | users | | CHECK |
| auth | users | | CHECK |
| auth | sso_providers | | CHECK |
| auth | saml_relay_states | | CHECK |
| auth | saml_relay_states | | CHECK |
| auth | saml_relay_states | | CHECK |
| auth | flow_state | | CHECK |
| auth | flow_state | | CHECK |
| auth | flow_state | | CHECK |
| auth | flow_state | | CHECK |
| auth | flow_state | | CHECK |
| auth | flow_state | | CHECK |
| auth | one_time_tokens | | CHECK |
| auth | one_time_tokens | | CHECK |
| auth | one_time_tokens | | CHECK |
| auth | one_time_tokens | | CHECK |
| auth | one_time_tokens | | CHECK |
| auth | one_time_tokens | | CHECK |
| auth | one_time_tokens | | CHECK |
| auth | audit_log_entries | | CHECK |
| auth | audit_log_entries | | CHECK |
| auth | mfa_factors | | CHECK |
| auth | mfa_factors | | CHECK |
| auth | mfa_factors | | CHECK |
| auth | mfa_factors | | CHECK |
| auth | mfa_factors | | CHECK |
| auth | mfa_factors | | CHECK |
| auth | sessions | | CHECK |
| auth | sessions | | CHECK |
| auth | sso_domains | | CHECK |
| auth | sso_domains | | CHECK |
| auth | sso_domains | | CHECK |
| auth | mfa_challenges | | CHECK |
| auth | mfa_challenges | | CHECK |
| auth | mfa_challenges | | CHECK |
| auth | mfa_challenges | | CHECK |
| auth | mfa_amr_claims | | CHECK |
| auth | mfa_amr_claims | | CHECK |
| auth | mfa_amr_claims | | CHECK |
| auth | mfa_amr_claims | | CHECK |
| auth | mfa_amr_claims | | CHECK |
| auth | saml_providers | | CHECK |
| auth | saml_providers | | CHECK |
| auth | saml_providers | | CHECK |
| auth | saml_providers | | CHECK |
| auth | identities | | CHECK |
| auth | identities | | CHECK |
| auth | identities | | CHECK |
| auth | identities | | CHECK |
| auth | identities | | CHECK |
| realtime | schema_migrations | | CHECK |
| realtime | subscription | | CHECK |
| realtime | subscription | | CHECK |
| realtime | subscription | | CHECK |
| realtime | subscription | | CHECK |
| realtime | subscription | | CHECK |
| realtime | subscription | | CHECK |
| realtime | subscription | | CHECK |
| realtime | messages | | CHECK |
| realtime | messages | | CHECK |
| realtime | messages | | CHECK |
| realtime | messages | | CHECK |
| realtime | messages | | CHECK |
| pgsodium | key | | CHECK |
| pgsodium | key | | CHECK |
| vault | secrets | | CHECK |
| vault | secrets | | CHECK |
| vault | secrets | | CHECK |
| vault | secrets | | CHECK |
| vault | secrets | | CHECK |
| supabase_migrations | schema_migrations | | CHECK |
| supabase_migrations | seed_files | | CHECK |
| supabase_migrations | seed_files | | CHECK |
| net | http_request_queue | | CHECK |
| net | http_request_queue | | CHECK |
| net | http_request_queue | | CHECK |
| net | http_request_queue | | CHECK |
| net | http_request_queue | | CHECK |
| net | _http_response | | CHECK |

View File

@ -0,0 +1,698 @@
| dependent_object | source_object |
| ---------------- | -------------------------------------------------------- |
| 12003 | pg_roles |
| 12008 | pg_shadow |
| 12013 | pg_group |
| 12017 | pg_user |
| 12017 | pg_shadow |
| 12017 | pg_shadow |
| 12017 | pg_shadow |
| 12017 | pg_shadow |
| 12017 | pg_shadow |
| 12017 | pg_shadow |
| 12017 | pg_shadow |
| 12017 | pg_shadow |
| 12021 | pg_policies |
| 12026 | pg_rules |
| 12031 | pg_views |
| 12036 | pg_tables |
| 12041 | pg_matviews |
| 12046 | pg_indexes |
| 12051 | pg_sequences |
| 12056 | pg_stats |
| 12061 | pg_stats_ext |
| 12066 | pg_stats_ext_exprs |
| 12071 | pg_publication_tables |
| 12076 | pg_locks |
| 12080 | pg_cursors |
| 12084 | pg_available_extensions |
| 12088 | pg_available_extension_versions |
| 12093 | pg_prepared_xacts |
| 12098 | pg_prepared_statements |
| 12102 | pg_seclabels |
| 12107 | pg_settings |
| 12108 | pg_settings |
| 12108 | pg_settings |
| 12108 | pg_settings |
| 12109 | pg_settings |
| 12113 | pg_file_settings |
| 12117 | pg_hba_file_rules |
| 12121 | pg_ident_file_mappings |
| 12125 | pg_timezone_abbrevs |
| 12129 | pg_timezone_names |
| 12133 | pg_config |
| 12137 | pg_shmem_allocations |
| 12141 | pg_backend_memory_contexts |
| 12145 | pg_stat_all_tables |
| 12150 | pg_stat_xact_all_tables |
| 12155 | pg_stat_sys_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12155 | pg_stat_all_tables |
| 12160 | pg_stat_xact_sys_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12160 | pg_stat_xact_all_tables |
| 12164 | pg_stat_user_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12164 | pg_stat_all_tables |
| 12169 | pg_stat_xact_user_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12169 | pg_stat_xact_all_tables |
| 12173 | pg_statio_all_tables |
| 12178 | pg_statio_sys_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12178 | pg_statio_all_tables |
| 12182 | pg_statio_user_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12182 | pg_statio_all_tables |
| 12186 | pg_stat_all_indexes |
| 12191 | pg_stat_sys_indexes |
| 12191 | pg_stat_all_indexes |
| 12191 | pg_stat_all_indexes |
| 12191 | pg_stat_all_indexes |
| 12191 | pg_stat_all_indexes |
| 12191 | pg_stat_all_indexes |
| 12191 | pg_stat_all_indexes |
| 12191 | pg_stat_all_indexes |
| 12191 | pg_stat_all_indexes |
| 12195 | pg_stat_user_indexes |
| 12195 | pg_stat_all_indexes |
| 12195 | pg_stat_all_indexes |
| 12195 | pg_stat_all_indexes |
| 12195 | pg_stat_all_indexes |
| 12195 | pg_stat_all_indexes |
| 12195 | pg_stat_all_indexes |
| 12195 | pg_stat_all_indexes |
| 12195 | pg_stat_all_indexes |
| 12199 | pg_statio_all_indexes |
| 12204 | pg_statio_sys_indexes |
| 12204 | pg_statio_all_indexes |
| 12204 | pg_statio_all_indexes |
| 12204 | pg_statio_all_indexes |
| 12204 | pg_statio_all_indexes |
| 12204 | pg_statio_all_indexes |
| 12204 | pg_statio_all_indexes |
| 12204 | pg_statio_all_indexes |
| 12208 | pg_statio_user_indexes |
| 12208 | pg_statio_all_indexes |
| 12208 | pg_statio_all_indexes |
| 12208 | pg_statio_all_indexes |
| 12208 | pg_statio_all_indexes |
| 12208 | pg_statio_all_indexes |
| 12208 | pg_statio_all_indexes |
| 12208 | pg_statio_all_indexes |
| 12212 | pg_statio_all_sequences |
| 12217 | pg_statio_sys_sequences |
| 12217 | pg_statio_all_sequences |
| 12217 | pg_statio_all_sequences |
| 12217 | pg_statio_all_sequences |
| 12217 | pg_statio_all_sequences |
| 12217 | pg_statio_all_sequences |
| 12221 | pg_statio_user_sequences |
| 12221 | pg_statio_all_sequences |
| 12221 | pg_statio_all_sequences |
| 12221 | pg_statio_all_sequences |
| 12221 | pg_statio_all_sequences |
| 12221 | pg_statio_all_sequences |
| 12225 | pg_stat_activity |
| 12230 | pg_stat_replication |
| 12235 | pg_stat_slru |
| 12239 | pg_stat_wal_receiver |
| 12243 | pg_stat_recovery_prefetch |
| 12247 | pg_stat_subscription |
| 12252 | pg_stat_ssl |
| 12256 | pg_stat_gssapi |
| 12260 | pg_replication_slots |
| 12265 | pg_stat_replication_slots |
| 12265 | pg_replication_slots |
| 12265 | pg_replication_slots |
| 12269 | pg_stat_database |
| 12274 | pg_stat_database_conflicts |
| 12278 | pg_stat_user_functions |
| 12283 | pg_stat_xact_user_functions |
| 12288 | pg_stat_archiver |
| 12292 | pg_stat_bgwriter |
| 12296 | pg_stat_wal |
| 12300 | pg_stat_progress_analyze |
| 12305 | pg_stat_progress_vacuum |
| 12310 | pg_stat_progress_cluster |
| 12315 | pg_stat_progress_create_index |
| 12320 | pg_stat_progress_basebackup |
| 12325 | pg_stat_progress_copy |
| 12330 | pg_user_mappings |
| 12335 | pg_replication_origin_status |
| 12339 | pg_stat_subscription_stats |
| 13231 | information_schema.information_schema_catalog_name |
| 13240 | information_schema.applicable_roles |
| 13245 | information_schema.administrable_role_authorizations |
| 13245 | information_schema.applicable_roles |
| 13245 | information_schema.applicable_roles |
| 13245 | information_schema.applicable_roles |
| 13249 | information_schema.attributes |
| 13254 | information_schema.character_sets |
| 13259 | information_schema.check_constraint_routine_usage |
| 13264 | information_schema.check_constraints |
| 13269 | information_schema.collations |
| 13274 | information_schema.collation_character_set_applicability |
| 13279 | information_schema.column_column_usage |
| 13284 | information_schema.column_domain_usage |
| 13289 | information_schema.column_privileges |
| 13294 | information_schema.column_udt_usage |
| 13299 | information_schema.columns |
| 13304 | information_schema.constraint_column_usage |
| 13309 | information_schema.constraint_table_usage |
| 13314 | information_schema.domain_constraints |
| 13319 | information_schema.domain_udt_usage |
| 13324 | information_schema.domains |
| 13329 | information_schema.enabled_roles |
| 13333 | information_schema.key_column_usage |
| 13338 | information_schema.parameters |
| 13343 | information_schema.referential_constraints |
| 13348 | information_schema.role_column_grants |
| 13348 | information_schema.enabled_roles |
| 13348 | information_schema.column_privileges |
| 13348 | information_schema.column_privileges |
| 13348 | information_schema.column_privileges |
| 13348 | information_schema.column_privileges |
| 13348 | information_schema.column_privileges |
| 13348 | information_schema.column_privileges |
| 13348 | information_schema.column_privileges |
| 13348 | information_schema.column_privileges |
| 13352 | information_schema.routine_column_usage |
| 13357 | information_schema.routine_privileges |
| 13362 | information_schema.role_routine_grants |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.routine_privileges |
| 13362 | information_schema.enabled_roles |
| 13366 | information_schema.routine_routine_usage |
| 13371 | information_schema.routine_sequence_usage |
| 13376 | information_schema.routine_table_usage |
| 13381 | information_schema.routines |
| 13386 | information_schema.schemata |
| 13390 | information_schema.sequences |
| 13415 | information_schema.table_constraints |
| 13420 | information_schema.table_privileges |
| 13425 | information_schema.role_table_grants |
| 13425 | information_schema.table_privileges |
| 13425 | information_schema.table_privileges |
| 13425 | information_schema.table_privileges |
| 13425 | information_schema.table_privileges |
| 13425 | information_schema.table_privileges |
| 13425 | information_schema.table_privileges |
| 13425 | information_schema.table_privileges |
| 13425 | information_schema.table_privileges |
| 13425 | information_schema.enabled_roles |
| 13429 | information_schema.tables |
| 13434 | information_schema.transforms |
| 13439 | information_schema.triggered_update_columns |
| 13444 | information_schema.triggers |
| 13449 | information_schema.udt_privileges |
| 13454 | information_schema.role_udt_grants |
| 13454 | information_schema.udt_privileges |
| 13454 | information_schema.udt_privileges |
| 13454 | information_schema.udt_privileges |
| 13454 | information_schema.udt_privileges |
| 13454 | information_schema.udt_privileges |
| 13454 | information_schema.udt_privileges |
| 13454 | information_schema.udt_privileges |
| 13454 | information_schema.enabled_roles |
| 13458 | information_schema.usage_privileges |
| 13463 | information_schema.role_usage_grants |
| 13463 | information_schema.usage_privileges |
| 13463 | information_schema.usage_privileges |
| 13463 | information_schema.usage_privileges |
| 13463 | information_schema.usage_privileges |
| 13463 | information_schema.usage_privileges |
| 13463 | information_schema.usage_privileges |
| 13463 | information_schema.usage_privileges |
| 13463 | information_schema.usage_privileges |
| 13463 | information_schema.enabled_roles |
| 13467 | information_schema.user_defined_types |
| 13472 | information_schema.view_column_usage |
| 13477 | information_schema.view_routine_usage |
| 13482 | information_schema.view_table_usage |
| 13487 | information_schema.views |
| 13492 | information_schema.data_type_privileges |
| 13492 | information_schema.routines |
| 13492 | information_schema.routines |
| 13492 | information_schema.routines |
| 13492 | information_schema.parameters |
| 13492 | information_schema.parameters |
| 13492 | information_schema.parameters |
| 13492 | information_schema.domains |
| 13492 | information_schema.domains |
| 13492 | information_schema.domains |
| 13492 | information_schema.columns |
| 13492 | information_schema.columns |
| 13492 | information_schema.columns |
| 13492 | information_schema.attributes |
| 13492 | information_schema.attributes |
| 13492 | information_schema.attributes |
| 13497 | information_schema.element_types |
| 13497 | information_schema.data_type_privileges |
| 13497 | information_schema.data_type_privileges |
| 13497 | information_schema.data_type_privileges |
| 13497 | information_schema.data_type_privileges |
| 13502 | information_schema._pg_foreign_table_columns |
| 13507 | information_schema.column_options |
| 13507 | information_schema._pg_foreign_table_columns |
| 13507 | information_schema._pg_foreign_table_columns |
| 13507 | information_schema._pg_foreign_table_columns |
| 13507 | information_schema._pg_foreign_table_columns |
| 13511 | information_schema._pg_foreign_data_wrappers |
| 13515 | information_schema.foreign_data_wrapper_options |
| 13515 | information_schema._pg_foreign_data_wrappers |
| 13515 | information_schema._pg_foreign_data_wrappers |
| 13515 | information_schema._pg_foreign_data_wrappers |
| 13519 | information_schema.foreign_data_wrappers |
| 13519 | information_schema._pg_foreign_data_wrappers |
| 13519 | information_schema._pg_foreign_data_wrappers |
| 13519 | information_schema._pg_foreign_data_wrappers |
| 13519 | information_schema._pg_foreign_data_wrappers |
| 13523 | information_schema._pg_foreign_servers |
| 13528 | information_schema.foreign_server_options |
| 13528 | information_schema._pg_foreign_servers |
| 13528 | information_schema._pg_foreign_servers |
| 13528 | information_schema._pg_foreign_servers |
| 13532 | information_schema.foreign_servers |
| 13532 | information_schema._pg_foreign_servers |
| 13532 | information_schema._pg_foreign_servers |
| 13532 | information_schema._pg_foreign_servers |
| 13532 | information_schema._pg_foreign_servers |
| 13532 | information_schema._pg_foreign_servers |
| 13532 | information_schema._pg_foreign_servers |
| 13532 | information_schema._pg_foreign_servers |
| 13536 | information_schema._pg_foreign_tables |
| 13541 | information_schema.foreign_table_options |
| 13541 | information_schema._pg_foreign_tables |
| 13541 | information_schema._pg_foreign_tables |
| 13541 | information_schema._pg_foreign_tables |
| 13541 | information_schema._pg_foreign_tables |
| 13545 | information_schema.foreign_tables |
| 13545 | information_schema._pg_foreign_tables |
| 13545 | information_schema._pg_foreign_tables |
| 13545 | information_schema._pg_foreign_tables |
| 13545 | information_schema._pg_foreign_tables |
| 13545 | information_schema._pg_foreign_tables |
| 13549 | information_schema._pg_user_mappings |
| 13549 | information_schema._pg_foreign_servers |
| 13549 | information_schema._pg_foreign_servers |
| 13549 | information_schema._pg_foreign_servers |
| 13549 | information_schema._pg_foreign_servers |
| 13554 | information_schema.user_mapping_options |
| 13554 | information_schema._pg_user_mappings |
| 13554 | information_schema._pg_user_mappings |
| 13554 | information_schema._pg_user_mappings |
| 13554 | information_schema._pg_user_mappings |
| 13554 | information_schema._pg_user_mappings |
| 13554 | information_schema._pg_user_mappings |
| 13559 | information_schema.user_mappings |
| 13559 | information_schema._pg_user_mappings |
| 13559 | information_schema._pg_user_mappings |
| 13559 | information_schema._pg_user_mappings |
| 16407 | pg_stat_statements_info |
| 16418 | pg_stat_statements |
| 16504 | auth.refresh_tokens_id_seq |
| 36106 | story_themes_pkey |
| 36106 | story_themes |
| 36111 | story_subjects_pkey |
| 36111 | story_subjects |
| 16566 | storage.buckets_pkey |
| 16566 | storage.buckets |
| 36116 | story_characters_pkey |
| 36116 | story_characters |
| 29103 | realtime.subscription |
| 36121 | story_settings_pkey |
| 36121 | story_settings |
| 65870 | auth.users_pkey |
| 65870 | auth.users |
| 65875 | interests |
| 65876 | interests |
| 65877 | interests |
| 65877 | interests |
| 65878 | interests |
| 53294 | stories_pkey |
| 53294 | stories |
| 53299 | stories_pkey |
| 16796 | pgsodium.key_key_id_seq |
| 16798 | pgsodium.key |
| 53299 | stories |
| 16857 | pgsodium.key_pkey |
| 16857 | pgsodium.key |
| 29233 | schools_pkey |
| 29233 | schools |
| 16893 | pgsodium.key |
| 16893 | pgsodium.key |
| 16893 | pgsodium.key |
| 16893 | pgsodium.key |
| 29248 | schools_pkey |
| 29248 | schools |
| 16918 | pgsodium.mask_columns |
| 16918 | pgsodium.masking_rule |
| 16918 | pgsodium.masking_rule |
| 16918 | pgsodium.masking_rule |
| 16918 | pgsodium.masking_rule |
| 16918 | pgsodium.masking_rule |
| 16918 | pgsodium.masking_rule |
| 16918 | pgsodium.masking_rule |
| 29265 | classes_pkey |
| 29265 | classes |
| 29279 | teachers_pkey |
| 29279 | teachers |
| 29284 | classes_pkey |
| 29284 | classes |
| 16897 | pgsodium.valid_key |
| 16897 | pgsodium.key |
| 16897 | pgsodium.key |
| 16897 | pgsodium.key |
| 16897 | pgsodium.key |
| 16897 | pgsodium.key |
| 16897 | pgsodium.key |
| 16897 | pgsodium.key |
| 16897 | pgsodium.key |
| 16897 | pgsodium.key |
| 16943 | pgsodium.decrypted_key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16943 | pgsodium.key |
| 16946 | pgsodium.key |
| 16913 | pgsodium.masking_rule |
| 16956 | pgsodium.valid_key |
| 16964 | pgsodium.key_pkey |
| 16964 | pgsodium.key |
| 16973 | vault.decrypted_secrets |
| 16973 | vault.secrets |
| 16973 | vault.secrets |
| 16973 | vault.secrets |
| 16973 | vault.secrets |
| 16973 | vault.secrets |
| 16973 | vault.secrets |
| 16973 | vault.secrets |
| 16973 | vault.secrets |
| 16975 | vault.secrets |
| 36166 | story_themes_pkey |
| 36166 | story_themes |
| 31511 | story_recordings |
| 36171 | story_subjects_pkey |
| 36171 | story_subjects |
| 36176 | story_characters_pkey |
| 36176 | story_characters |
| 36181 | story_settings_pkey |
| 36181 | story_settings |
| 29333 | stories |
| 29338 | students_pkey |
| 29338 | students |
| 29346 | stories |
| 29346 | students |
| 29346 | students |
| 29347 | stories |
| 29347 | students |
| 29347 | students |
| 31552 | auth.users_pkey |
| 31552 | auth.users |
| 31558 | story_recordings |
| 31558 | students |
| 31558 | students |
| 31558 | classes |
| 31558 | classes |
| 31560 | story_recordings |
| 31560 | students |
| 31560 | students |
| 53384 | stories |
| 36241 | story_settings |
| 36241 | story_settings |
| 36241 | story_characters |
| 36241 | story_characters |
| 36241 | story_subjects |
| 36241 | story_subjects |
| 36241 | story_themes |
| 36241 | story_themes |
| 36241 | stories |
| 36241 | stories |
| 36241 | stories |
| 36241 | stories |
| 36241 | stories |
| 75352 | storage.objects |
| 53426 | storage.objects |
| 53426 | storage.objects |
| 29441 | schools |
| 29442 | schools |
| 29442 | schools |
| 53468 | stories |
| 53468 | stories |
| 53468 | storage.objects |
| 53468 | storage.objects |
| 36331 | story_details |
| 36331 | story_settings |
| 36331 | story_settings |
| 36331 | story_settings |
| 36331 | story_settings |
| 36331 | story_characters |
| 36331 | story_characters |
| 36331 | story_characters |
| 36331 | story_characters |
| 36331 | story_subjects |
| 36331 | story_subjects |
| 36331 | story_subjects |
| 36331 | story_subjects |
| 36331 | story_themes |
| 36331 | story_themes |
| 36331 | story_themes |
| 36331 | story_themes |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 36331 | stories |
| 29487 | teachers |
| 29494 | teacher_invites |
| 29501 | schools_pkey |
| 29501 | schools |
| 29509 | teachers |
| 29510 | teachers |
| 29510 | schools |
| 29511 | teacher_invites |
| 29511 | schools |
| 52098 | storage.objects |
| 52099 | storage.objects |
| 29555 | students |
| 29578 | schools_pkey |
| 29578 | schools |
| 29584 | students |
| 74984 | phonics_exercise_types_pkey |
| 74984 | phonics_exercise_types |
| 75008 | phonics_exercises_pkey |
| 75008 | phonics_exercises |
| 75013 | phonics_words_pkey |
| 75013 | phonics_words |
| 75036 | phonics_exercises_pkey |
| 75036 | phonics_exercises |
| 75041 | media_types_pkey |
| 75041 | media_types |
| 75062 | auth.users_pkey |
| 75062 | auth.users |
| 75067 | phonics_exercises_pkey |
| 75067 | phonics_exercises |
| 75079 | auth.users_pkey |
| 75079 | auth.users |
| 75084 | phonics_exercises_pkey |
| 75084 | phonics_exercises |
| 75098 | student_phonics_attempts_pkey |
| 75098 | student_phonics_attempts |
| 75103 | phonics_words_pkey |
| 75103 | phonics_words |
| 75128 | achievement_types_pkey |
| 75128 | achievement_types |
| 75142 | auth.users_pkey |
| 75142 | auth.users |
| 29614 | classes |
| 29615 | classes |
| 29616 | classes |
| 29616 | classes |
| 75147 | phonics_achievements_pkey |
| 75147 | phonics_achievements |
| 29638 | students |
| 29638 | schools |
| 29639 | students |
| 29639 | schools |
| 29709 | students_pkey |
| 29709 | students |
| 29716 | storage.objects |
| 29717 | storage.objects |
| 29748 | story_recordings |
| 29749 | story_recordings |
| 74045 | storage.objects |
| 34119 | net.http_request_queue_id_seq |
| 29823 | auth.users |
| 53921 | story_exercise_words |
| 53928 | stories_pkey |
| 53928 | stories |
| 29937 | students_pkey |
| 29937 | students |
| 29942 | achievements_pkey |
| 29942 | achievements |
| 29997 | students_pkey |
| 29997 | students |
| 30002 | achievements_pkey |
| 30002 | achievements |
| 34428 | story_recordings |
| 34429 | story_recordings |
| 34430 | story_recordings |
| 34431 | story_recordings |
| 30092 | story_recordings |
| 30136 | storage.objects |
| 30136 | storage.objects |
| 43939 | storage.objects |
| 43940 | storage.objects |
| 34950 | story_themes |
| 34951 | story_subjects |
| 34952 | story_characters |
| 34953 | story_settings |
| 37419 | stories_pkey |
| 37419 | stories |
| 37570 | storage.objects |
| 37571 | storage.objects |
| 37572 | storage.objects |
| 37573 | storage.objects |
| 28652 | auth.users |
| 28652 | auth.users |
| 28665 | auth.users |
| 28673 | auth.users_pkey |
| 28673 | auth.users |
| 28701 | auth.users_pkey |
| 28701 | auth.users |
| 28706 | auth.sessions_pkey |
| 28706 | auth.sessions |
| 28738 | auth.users_pkey |
| 28738 | auth.users |
| 28751 | auth.mfa_factors_pkey |
| 28751 | auth.mfa_factors |
| 28763 | auth.sessions_pkey |
| 28763 | auth.sessions |
| 28777 | auth.sso_providers |
| 28786 | auth.sso_domains |
| 28791 | auth.sso_providers_pkey |
| 28791 | auth.sso_providers |
| 28801 | auth.saml_providers |
| 28802 | auth.saml_providers |
| 28803 | auth.saml_providers |
| 28810 | auth.sso_providers_pkey |
| 28810 | auth.sso_providers |
| 28819 | auth.saml_relay_states |
| 28824 | auth.sso_providers_pkey |
| 28824 | auth.sso_providers |
| 28851 | auth.identities |
| 28883 | auth.flow_state_pkey |
| 28883 | auth.flow_state |
| 28924 | auth.one_time_tokens |
| 28929 | auth.users_pkey |
| 28929 | auth.users |
| 28948 | storage.objects |
| 28985 | storage.buckets_pkey |
| 28985 | storage.buckets |
| 29000 | storage.s3_multipart_uploads_pkey |
| 29000 | storage.s3_multipart_uploads |
| 29005 | storage.buckets_pkey |
| 29005 | storage.buckets |

View File

@ -0,0 +1,639 @@
| table_schema | table_name | column_name | data_type | is_nullable | column_default |
| ------------------- | ------------------------------- | --------------------------- | --------------------------- | ----------- | -------------------------------------------------- |
| realtime | subscription | id | bigint | NO | |
| realtime | schema_migrations | inserted_at | timestamp without time zone | YES | |
| public | stories | student_id | uuid | NO | |
| storage | s3_multipart_uploads | upload_signature | text | NO | |
| pgsodium | decrypted_key | key_context | bytea | YES | |
| pgsodium | valid_key | associated_data | text | YES | |
| pgsodium | key | status | USER-DEFINED | YES | 'valid'::pgsodium.key_status |
| auth | audit_log_entries | id | uuid | NO | |
| public | achievement_types | name | character varying | NO | |
| public | student_phonics_attempt_answers | answer_text | text | YES | |
| public | phonics_categories | id | uuid | NO | uuid_generate_v4() |
| public | phonics_exercise_media | order_index | integer | YES | |
| public | phonics_exercise_words | word_id | uuid | YES | |
| storage | migrations | name | character varying | NO | |
| net | _http_response | id | bigint | YES | |
| auth | identities | provider | text | NO | |
| extensions | pg_stat_statements | mean_exec_time | double precision | YES | |
| auth | mfa_factors | secret | text | YES | |
| auth | users | last_sign_in_at | timestamp with time zone | YES | |
| storage | objects | owner_id | text | YES | |
| vault | decrypted_secrets | nonce | bytea | YES | |
| auth | users | phone_confirmed_at | timestamp with time zone | YES | |
| extensions | pg_stat_statements | local_blks_hit | bigint | YES | |
| pgsodium | valid_key | created | timestamp with time zone | YES | |
| public | interests | id | uuid | NO | gen_random_uuid() |
| pgsodium | decrypted_key | associated_data | text | YES | |
| public | phonics_exercises | difficulty_level | integer | NO | |
| realtime | messages | topic | text | NO | |
| supabase_migrations | schema_migrations | statements | ARRAY | YES | |
| public | schools | address | text | YES | |
| auth | sessions | refreshed_at | timestamp without time zone | YES | |
| public | students | nickname | character varying | YES | |
| extensions | pg_stat_statements | queryid | bigint | YES | |
| auth | users | role | character varying | YES | |
| public | story_details | setting_title | text | YES | |
| public | student_phonics_progress | last_score | double precision | YES | 0 |
| public | phonics_exercise_types | id | uuid | NO | uuid_generate_v4() |
| auth | mfa_amr_claims | id | uuid | NO | |
| public | stories | subject_id | uuid | YES | |
| public | stories | setting_id | uuid | YES | |
| pgsodium | key | raw_key | bytea | YES | |
| pgsodium | key | parent_key | uuid | YES | |
| public | teacher_invites | email | text | NO | |
| vault | decrypted_secrets | updated_at | timestamp with time zone | YES | |
| extensions | pg_stat_statements | jit_functions | bigint | YES | |
| realtime | subscription | created_at | timestamp without time zone | NO | timezone('utc'::text, now()) |
| storage | s3_multipart_uploads_parts | created_at | timestamp with time zone | NO | now() |
| realtime | messages | private | boolean | YES | false |
| auth | users | phone | text | YES | NULL::character varying |
| public | schools | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| auth | saml_providers | attribute_mapping | jsonb | YES | |
| extensions | pg_stat_statements | shared_blks_written | bigint | YES | |
| public | phonics_achievements | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | students | school_id | uuid | NO | |
| public | interests | item | text | NO | |
| pgsodium | valid_key | status | USER-DEFINED | YES | |
| storage | s3_multipart_uploads | user_metadata | jsonb | YES | |
| public | story_themes | slug | text | NO | |
| vault | secrets | nonce | bytea | YES | pgsodium.crypto_aead_det_noncegen() |
| storage | objects | user_metadata | jsonb | YES | |
| storage | objects | version | text | YES | |
| public | teacher_invites | status | text | YES | 'pending'::text |
| public | story_subjects | active | boolean | YES | true |
| pgsodium | decrypted_key | comment | text | YES | |
| net | http_request_queue | method | text | NO | |
| extensions | pg_stat_statements | userid | oid | YES | |
| auth | users | instance_id | uuid | YES | |
| public | phonics_exercise_types | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | students | avatar_settings | jsonb | YES | |
| realtime | subscription | claims | jsonb | NO | |
| realtime | messages | inserted_at | timestamp without time zone | NO | now() |
| public | phonics_categories | level | integer | NO | |
| storage | objects | bucket_id | text | YES | |
| public | story_characters | slug | text | NO | |
| public | students | birth_date | date | YES | |
| auth | refresh_tokens | revoked | boolean | YES | |
| storage | s3_multipart_uploads | owner_id | text | YES | |
| public | teachers | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| pgsodium | decrypted_key | created | timestamp with time zone | YES | |
| public | achievements | name | text | YES | |
| storage | s3_multipart_uploads_parts | upload_id | text | NO | |
| auth | flow_state | provider_refresh_token | text | YES | |
| public | student_phonics_achievements | achievement_id | uuid | YES | |
| vault | decrypted_secrets | description | text | YES | |
| public | classes | period | text | YES | |
| pgsodium | key | raw_key_nonce | bytea | YES | |
| public | phonics_words | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | teacher_invites | expires_at | timestamp with time zone | NO | |
| auth | identities | provider_id | text | NO | |
| net | _http_response | headers | jsonb | YES | |
| auth | mfa_challenges | otp_code | text | YES | |
| public | stories | character_id | uuid | YES | |
| public | story_settings | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| auth | flow_state | provider_type | text | NO | |
| public | teacher_invites | name | text | NO | |
| public | classes | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | story_exercise_words | phonemes | ARRAY | YES | |
| public | story_settings | active | boolean | YES | true |
| public | story_generations | model_used | text | NO | |
| extensions | pg_stat_statements | toplevel | boolean | YES | |
| auth | users | aud | character varying | YES | |
| realtime | messages | extension | text | NO | |
| public | schools | phone | text | YES | |
| extensions | pg_stat_statements_info | dealloc | bigint | YES | |
| public | teachers | subject | text | YES | |
| pgsodium | masking_rule | priority | integer | YES | |
| extensions | pg_stat_statements | jit_emission_time | double precision | YES | |
| pgsodium | valid_key | id | uuid | YES | |
| vault | secrets | updated_at | timestamp with time zone | NO | CURRENT_TIMESTAMP |
| public | story_details | subject_title | text | YES | |
| auth | users | is_anonymous | boolean | NO | false |
| public | story_subjects | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | students | accessibility_settings | jsonb | YES | |
| extensions | pg_stat_statements | wal_bytes | numeric | YES | |
| public | story_recordings | analysis | jsonb | YES | |
| public | student_phonics_achievements | id | uuid | NO | uuid_generate_v4() |
| vault | decrypted_secrets | id | uuid | YES | |
| auth | identities | identity_data | jsonb | NO | |
| net | _http_response | error_msg | text | YES | |
| auth | instances | uuid | uuid | YES | |
| auth | saml_providers | updated_at | timestamp with time zone | YES | |
| public | phonics_categories | updated_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | phonics_exercise_words | is_correct_answer | boolean | YES | false |
| realtime | subscription | entity | regclass | NO | |
| public | student_achievements | student_id | uuid | YES | |
| auth | users | email_change | character varying | YES | |
| pgsodium | masking_rule | attname | name | YES | |
| storage | s3_multipart_uploads | bucket_id | text | NO | |
| extensions | pg_stat_statements | min_exec_time | double precision | YES | |
| public | story_pages | image_path_thumb | text | YES | |
| public | phonics_achievements | icon_url | text | YES | |
| pgsodium | decrypted_key | id | uuid | YES | |
| auth | identities | updated_at | timestamp with time zone | YES | |
| storage | buckets | owner_id | text | YES | |
| public | story_pages | story_id | uuid | YES | |
| extensions | pg_stat_statements | max_plan_time | double precision | YES | |
| net | _http_response | content_type | text | YES | |
| auth | users | confirmation_token | character varying | YES | |
| public | student_phonics_progress | completed_at | timestamp with time zone | YES | |
| public | student_phonics_achievements | earned_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| auth | saml_relay_states | sso_provider_id | uuid | NO | |
| public | students | uppercase_text_preferences | boolean | YES | false |
| vault | decrypted_secrets | secret | text | YES | |
| pgsodium | decrypted_key | expires | timestamp with time zone | YES | |
| storage | s3_multipart_uploads | id | text | NO | |
| auth | one_time_tokens | relates_to | text | NO | |
| public | phonics_categories | description | text | YES | |
| auth | sessions | aal | USER-DEFINED | YES | |
| public | story_details | theme_title | text | YES | |
| pgsodium | mask_columns | nonce_column | text | YES | |
| public | phonics_word_audio | created_at | timestamp with time zone | YES | timezone('utc'::text, now()) |
| public | phonics_exercise_words | id | uuid | NO | uuid_generate_v4() |
| public | phonics_exercises | instructions | text | NO | |
| auth | identities | id | uuid | NO | gen_random_uuid() |
| public | phonics_exercise_types | description | text | YES | |
| auth | mfa_factors | created_at | timestamp with time zone | NO | |
| extensions | pg_stat_statements | total_plan_time | double precision | YES | |
| auth | users | email_confirmed_at | timestamp with time zone | YES | |
| public | student_achievements_old | student_id | uuid | YES | |
| public | teacher_invites | id | uuid | NO | uuid_generate_v4() |
| public | story_pages | image_path_medium | text | YES | |
| public | story_pages | image_url_large | text | YES | |
| pgsodium | valid_key | key_type | USER-DEFINED | YES | |
| storage | buckets | name | text | NO | |
| public | interests | category | text | NO | |
| public | story_details | status | text | YES | |
| public | schools | id | uuid | NO | uuid_generate_v4() |
| public | student_phonics_attempts | time_spent_seconds | integer | YES | |
| pgsodium | masking_rule | associated_columns | text | YES | |
| auth | sessions | updated_at | timestamp with time zone | YES | |
| pgsodium | masking_rule | view_name | text | YES | |
| public | phonics_exercise_media | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | story_generations | story_id | uuid | YES | |
| public | media_types | name | character varying | NO | |
| public | phonics_exercises | points | integer | YES | 10 |
| pgsodium | mask_columns | key_id_column | text | YES | |
| public | phonics_achievements | id | uuid | NO | uuid_generate_v4() |
| pgsodium | decrypted_key | key_id | bigint | YES | |
| public | story_recordings | error_count | integer | YES | |
| public | story_exercise_words | story_id | uuid | YES | |
| public | story_details | setting_id | uuid | YES | |
| public | classes | name | text | NO | |
| vault | decrypted_secrets | key_id | uuid | YES | |
| public | story_recordings | id | uuid | NO | uuid_generate_v4() |
| auth | users | invited_at | timestamp with time zone | YES | |
| auth | mfa_challenges | created_at | timestamp with time zone | NO | |
| public | student_phonics_progress | stars | integer | YES | 0 |
| extensions | pg_stat_statements | min_plan_time | double precision | YES | |
| auth | saml_providers | entity_id | text | NO | |
| public | story_details | character_title | text | YES | |
| public | phonics_exercises | estimated_time_seconds | integer | YES | |
| auth | instances | updated_at | timestamp with time zone | YES | |
| pgsodium | valid_key | key_context | bytea | YES | |
| public | teachers | id | uuid | NO | uuid_generate_v4() |
| public | students | notification_preferences | jsonb | YES | |
| pgsodium | masking_rule | attnum | integer | YES | |
| public | story_subjects | title | text | NO | |
| extensions | pg_stat_statements | blk_write_time | double precision | YES | |
| vault | secrets | description | text | NO | ''::text |
| auth | users | banned_until | timestamp with time zone | YES | |
| auth | flow_state | id | uuid | NO | |
| auth | mfa_factors | factor_type | USER-DEFINED | NO | |
| auth | identities | email | text | YES | |
| auth | users | email_change_token_current | character varying | YES | ''::character varying |
| public | student_phonics_progress | completed | boolean | YES | false |
| public | student_achievements | metadata | jsonb | YES | |
| extensions | pg_stat_statements | temp_blks_written | bigint | YES | |
| public | story_settings | id | uuid | NO | uuid_generate_v4() |
| public | story_details | character_id | uuid | YES | |
| public | teachers | email | text | NO | |
| auth | saml_relay_states | redirect_to | text | YES | |
| public | story_details | context | text | YES | |
| public | story_pages | image_url | text | NO | |
| public | schools | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| auth | saml_providers | created_at | timestamp with time zone | YES | |
| realtime | messages | event | text | YES | |
| public | story_details | character_icon | text | YES | |
| public | phonics_exercises | type_id | uuid | YES | |
| pgsodium | masking_rule | nonce_column | text | YES | |
| public | story_settings | description | text | NO | |
| auth | one_time_tokens | user_id | uuid | NO | |
| public | student_phonics_progress | exercise_id | uuid | YES | |
| auth | mfa_factors | id | uuid | NO | |
| public | students | language | USER-DEFINED | YES | 'pt-BR'::language_enum |
| public | phonics_word_audio | word | text | NO | |
| net | _http_response | created | timestamp with time zone | NO | now() |
| public | teacher_invites | message | text | YES | |
| public | classes | teacher_id | uuid | YES | |
| public | story_subjects | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| vault | secrets | created_at | timestamp with time zone | NO | CURRENT_TIMESTAMP |
| auth | flow_state | code_challenge_method | USER-DEFINED | NO | |
| public | story_recordings | fluency_score | integer | YES | |
| auth | sso_domains | domain | text | NO | |
| auth | sso_providers | resource_id | text | YES | |
| storage | s3_multipart_uploads | version | text | NO | |
| public | student_phonics_progress | correct_answers_count | integer | YES | 0 |
| public | phonics_achievements | description | text | YES | |
| public | student_achievements_old | metadata | jsonb | YES | |
| auth | saml_providers | name_id_format | text | YES | |
| public | phonics_exercise_words | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | story_pages | image_path_large | text | YES | |
| pgsodium | mask_columns | attname | name | YES | |
| public | phonics_exercise_media | media_type_id | uuid | YES | |
| auth | sessions | id | uuid | NO | |
| public | story_recordings | self_corrections | integer | YES | |
| public | story_details | student_id | uuid | YES | |
| auth | mfa_challenges | web_authn_session_data | jsonb | YES | |
| public | student_phonics_attempts | student_id | uuid | YES | |
| public | classes | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| storage | buckets | updated_at | timestamp with time zone | YES | now() |
| public | story_recordings | audio_url | text | YES | |
| auth | audit_log_entries | ip_address | character varying | NO | ''::character varying |
| public | student_phonics_attempt_answers | attempt_id | uuid | YES | |
| pgsodium | key | key_type | USER-DEFINED | YES | |
| auth | mfa_factors | friendly_name | text | YES | |
| public | student_phonics_progress | id | uuid | NO | uuid_generate_v4() |
| public | story_settings | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | story_subjects | description | text | NO | |
| public | stories | content | jsonb | NO | |
| auth | flow_state | provider_access_token | text | YES | |
| vault | secrets | secret | text | NO | |
| public | interests | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | teachers | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| storage | s3_multipart_uploads | created_at | timestamp with time zone | NO | now() |
| supabase_migrations | seed_files | hash | text | NO | |
| realtime | subscription | claims_role | regrole | NO | |
| auth | saml_providers | metadata_xml | text | NO | |
| public | phonics_exercises | id | uuid | NO | uuid_generate_v4() |
| auth | mfa_challenges | verified_at | timestamp with time zone | YES | |
| pgsodium | key | comment | text | YES | |
| net | _http_response | timed_out | boolean | YES | |
| public | story_recordings | created_at | timestamp with time zone | NO | now() |
| public | classes | grade | text | NO | |
| public | teacher_invites | token | text | NO | |
| public | stories | context | text | YES | |
| auth | flow_state | created_at | timestamp with time zone | YES | |
| auth | sso_domains | id | uuid | NO | |
| public | phonics_achievements | required_count | integer | YES | 1 |
| public | students | dark_mode | boolean | YES | false |
| public | teachers | status | text | YES | 'pending'::text |
| pgsodium | mask_columns | key_id | text | YES | |
| public | phonics_exercise_media | id | uuid | NO | uuid_generate_v4() |
| public | story_details | setting_icon | text | YES | |
| public | schools | director_name | text | NO | 'Não informado'::text |
| auth | sessions | created_at | timestamp with time zone | YES | |
| public | phonics_categories | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| auth | mfa_amr_claims | created_at | timestamp with time zone | NO | |
| realtime | messages | updated_at | timestamp without time zone | NO | now() |
| public | classes | id | uuid | NO | uuid_generate_v4() |
| public | story_recordings | student_id | uuid | YES | |
| public | student_phonics_progress | last_attempt_at | timestamp with time zone | YES | |
| auth | mfa_factors | phone | text | YES | |
| auth | mfa_challenges | id | uuid | NO | |
| auth | identities | created_at | timestamp with time zone | YES | |
| public | students | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | students | status | text | NO | 'active'::text |
| public | teacher_classes | teacher_id | uuid | NO | |
| extensions | pg_stat_statements | jit_emission_count | bigint | YES | |
| pgsodium | mask_columns | format_type | text | YES | |
| auth | sessions | not_after | timestamp with time zone | YES | |
| public | phonics_exercise_media | url | text | NO | |
| net | http_request_queue | body | bytea | YES | |
| public | story_themes | icon | text | NO | |
| public | phonics_achievements | name | character varying | NO | |
| auth | sso_domains | created_at | timestamp with time zone | YES | |
| public | students | preferred_themes | ARRAY | YES | |
| pgsodium | valid_key | expires | timestamp with time zone | YES | |
| public | story_subjects | id | uuid | NO | uuid_generate_v4() |
| public | students | class_id | uuid | NO | |
| vault | secrets | id | uuid | NO | gen_random_uuid() |
| extensions | pg_stat_statements | jit_optimization_time | double precision | YES | |
| vault | decrypted_secrets | created_at | timestamp with time zone | YES | |
| auth | refresh_tokens | id | bigint | NO | nextval('auth.refresh_tokens_id_seq'::regclass) |
| auth | flow_state | auth_code | text | NO | |
| auth | users | encrypted_password | character varying | YES | |
| public | student_phonics_progress | attempts | integer | YES | 0 |
| extensions | pg_stat_statements | plans | bigint | YES | |
| auth | mfa_factors | updated_at | timestamp with time zone | NO | |
| public | story_characters | icon | text | NO | |
| storage | objects | created_at | timestamp with time zone | YES | now() |
| auth | users | email_change_confirm_status | smallint | YES | 0 |
| public | story_settings | title | text | NO | |
| extensions | pg_stat_statements | blk_read_time | double precision | YES | |
| public | phonics_exercises | title | character varying | NO | |
| auth | saml_providers | id | uuid | NO | |
| auth | sessions | user_agent | text | YES | |
| public | story_recordings | processed_at | timestamp with time zone | YES | |
| storage | s3_multipart_uploads_parts | bucket_id | text | NO | |
| pgsodium | decrypted_key | name | text | YES | |
| public | phonics_words | word | character varying | NO | |
| public | teachers | name | text | NO | |
| auth | sso_providers | created_at | timestamp with time zone | YES | |
| storage | buckets | file_size_limit | bigint | YES | |
| auth | sso_domains | sso_provider_id | uuid | NO | |
| public | stories | status | text | YES | 'draft'::text |
| public | story_exercise_words | created_at | timestamp with time zone | YES | now() |
| public | student_phonics_progress | xp_earned | integer | YES | 0 |
| public | student_phonics_progress | updated_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | story_generations | language_type | USER-DEFINED | NO | 'pt-BR'::language_enum |
| public | phonics_exercise_media | exercise_id | uuid | YES | |
| pgsodium | key | key_id | bigint | YES | nextval('pgsodium.key_key_id_seq'::regclass) |
| auth | mfa_amr_claims | session_id | uuid | NO | |
| public | teacher_classes | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | story_details | title | text | YES | |
| public | student_phonics_attempts | exercise_id | uuid | YES | |
| public | story_recordings | improvements | ARRAY | YES | |
| pgsodium | masking_rule | key_id | text | YES | |
| public | students | preferred_font_size | integer | YES | 16 |
| public | story_recordings | suggestions | text | YES | |
| public | interests | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | phonics_exercises | is_active | boolean | YES | true |
| public | phonics_exercises | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | phonics_words | syllables_count | integer | NO | |
| public | story_details | theme_icon | text | YES | |
| supabase_migrations | seed_files | path | text | NO | |
| extensions | pg_stat_statements | jit_optimization_count | bigint | YES | |
| public | phonics_exercises | category_id | uuid | YES | |
| net | _http_response | content | text | YES | |
| public | students | last_active_at | timestamp with time zone | YES | |
| public | story_pages | image_url_thumb | text | YES | |
| public | student_phonics_attempt_answers | id | uuid | NO | uuid_generate_v4() |
| public | phonics_categories | order_index | integer | NO | |
| auth | one_time_tokens | token_type | USER-DEFINED | NO | |
| public | student_phonics_progress | student_id | uuid | YES | |
| public | phonics_word_audio | audio_url | text | NO | |
| pgsodium | masking_rule | col_description | text | YES | |
| auth | refresh_tokens | user_id | character varying | YES | |
| auth | saml_relay_states | updated_at | timestamp with time zone | YES | |
| extensions | pg_stat_statements | max_exec_time | double precision | YES | |
| public | students | email | text | NO | |
| auth | users | email_change_sent_at | timestamp with time zone | YES | |
| auth | saml_providers | sso_provider_id | uuid | NO | |
| auth | identities | last_sign_in_at | timestamp with time zone | YES | |
| auth | users | email_change_token_new | character varying | YES | |
| extensions | pg_stat_statements | total_exec_time | double precision | YES | |
| public | student_phonics_progress | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | students | reading_goals | jsonb | YES | |
| public | phonics_words | id | uuid | NO | uuid_generate_v4() |
| public | story_subjects | slug | text | NO | |
| public | students | id | uuid | NO | uuid_generate_v4() |
| pgsodium | masking_rule | relnamespace | regnamespace | YES | |
| vault | secrets | name | text | YES | |
| public | phonics_exercises | required_score | double precision | YES | 0.7 |
| public | story_themes | active | boolean | YES | true |
| auth | refresh_tokens | instance_id | uuid | YES | |
| public | story_details | subject_id | uuid | YES | |
| net | http_request_queue | timeout_milliseconds | integer | NO | |
| auth | one_time_tokens | updated_at | timestamp without time zone | NO | now() |
| public | student_phonics_attempt_answers | is_correct | boolean | NO | |
| storage | objects | updated_at | timestamp with time zone | YES | now() |
| public | story_characters | active | boolean | YES | true |
| public | story_generations | original_prompt | text | NO | |
| public | teacher_classes | id | uuid | NO | uuid_generate_v4() |
| auth | mfa_amr_claims | authentication_method | text | NO | |
| public | media_types | description | text | YES | |
| auth | users | email | character varying | YES | |
| extensions | pg_stat_statements | query | text | YES | |
| pgsodium | masking_rule | security_invoker | boolean | YES | |
| public | story_exercise_words | word | text | NO | |
| extensions | pg_stat_statements | shared_blks_dirtied | bigint | YES | |
| auth | users | updated_at | timestamp with time zone | YES | |
| public | story_recordings | words_per_minute | integer | YES | |
| public | classes | school_id | uuid | NO | |
| storage | s3_multipart_uploads_parts | key | text | NO | |
| public | story_details | updated_at | timestamp with time zone | YES | |
| auth | mfa_challenges | factor_id | uuid | NO | |
| pgsodium | masking_rule | attrelid | oid | YES | |
| public | students | name | text | NO | |
| storage | s3_multipart_uploads_parts | owner_id | text | YES | |
| pgsodium | decrypted_key | key_type | USER-DEFINED | YES | |
| auth | flow_state | user_id | uuid | YES | |
| auth | refresh_tokens | token | character varying | YES | |
| public | story_details | subject_icon | text | YES | |
| auth | schema_migrations | version | character varying | NO | |
| public | phonics_word_audio | audio_path | text | NO | |
| auth | one_time_tokens | token_hash | text | NO | |
| public | story_settings | slug | text | NO | |
| public | story_recordings | transcription | text | YES | |
| storage | objects | metadata | jsonb | YES | |
| public | story_characters | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| auth | mfa_factors | web_authn_credential | jsonb | YES | |
| public | phonics_words | phonetic_transcription | character varying | YES | |
| public | teachers | school_id | uuid | NO | |
| vault | decrypted_secrets | decrypted_secret | text | YES | |
| public | story_recordings | accuracy_score | integer | YES | |
| public | story_themes | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | story_recordings | story_id | uuid | YES | |
| auth | sessions | tag | text | YES | |
| pgsodium | decrypted_key | parent_key | uuid | YES | |
| pgsodium | valid_key | key_id | bigint | YES | |
| extensions | pg_stat_statements | jit_generation_time | double precision | YES | |
| public | student_phonics_attempts | score | double precision | NO | |
| auth | users | is_super_admin | boolean | YES | |
| public | story_details | content | jsonb | YES | |
| public | teachers | class_ids | ARRAY | YES | |
| extensions | pg_stat_statements | shared_blks_hit | bigint | YES | |
| public | teacher_classes | class_id | uuid | NO | |
| public | story_generations | id | uuid | NO | uuid_generate_v4() |
| auth | flow_state | auth_code_issued_at | timestamp with time zone | YES | |
| public | media_types | id | uuid | NO | uuid_generate_v4() |
| public | students | avatar_url | text | YES | |
| auth | flow_state | updated_at | timestamp with time zone | YES | |
| public | phonics_achievements | type_id | uuid | YES | |
| auth | sso_providers | updated_at | timestamp with time zone | YES | |
| public | story_exercise_words | id | uuid | NO | uuid_generate_v4() |
| public | story_details | id | uuid | YES | |
| public | schools | email | text | YES | |
| public | story_pages | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| extensions | pg_stat_statements | local_blks_read | bigint | YES | |
| public | student_phonics_attempts | id | uuid | NO | uuid_generate_v4() |
| auth | users | phone_change | text | YES | ''::character varying |
| realtime | messages | payload | jsonb | YES | |
| public | students | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| auth | refresh_tokens | session_id | uuid | YES | |
| public | story_exercise_words | exercise_type | text | NO | |
| auth | sso_providers | id | uuid | NO | |
| auth | mfa_factors | last_challenged_at | timestamp with time zone | YES | |
| public | teacher_invites | subject | text | YES | |
| auth | mfa_factors | web_authn_aaguid | uuid | YES | |
| public | media_types | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| extensions | pg_stat_statements | temp_blk_write_time | double precision | YES | |
| pgsodium | mask_columns | attrelid | oid | YES | |
| auth | users | reauthentication_sent_at | timestamp with time zone | YES | |
| auth | sessions | user_id | uuid | NO | |
| public | story_generations | ai_response | text | NO | |
| auth | mfa_amr_claims | updated_at | timestamp with time zone | NO | |
| realtime | subscription | filters | ARRAY | NO | '{}'::realtime.user_defined_filter[] |
| public | student_phonics_attempt_answers | word_id | uuid | YES | |
| auth | one_time_tokens | id | uuid | NO | |
| public | phonics_exercise_words | order_index | integer | YES | |
| auth | mfa_factors | user_id | uuid | NO | |
| public | phonics_word_audio | id | uuid | NO | uuid_generate_v4() |
| public | students | guardian_phone | text | YES | |
| pgsodium | masking_rule | relname | name | YES | |
| storage | s3_multipart_uploads | key | text | NO | |
| auth | sessions | ip | inet | YES | |
| auth | refresh_tokens | updated_at | timestamp with time zone | YES | |
| public | story_recordings | pronunciation_score | integer | YES | |
| extensions | pg_stat_statements | jit_inlining_count | bigint | YES | |
| storage | buckets | public | boolean | YES | false |
| public | stories | updated_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| auth | flow_state | authentication_method | text | NO | |
| pgsodium | key | name | text | YES | |
| pgsodium | key | key_context | bytea | YES | '\x7067736f6469756d'::bytea |
| public | story_settings | icon | text | NO | |
| public | story_generations | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| storage | objects | name | text | YES | |
| public | story_characters | title | text | NO | |
| public | student_achievements | id | uuid | NO | uuid_generate_v4() |
| public | story_exercise_words | syllable_pattern | text | YES | |
| auth | flow_state | code_challenge | text | NO | |
| public | stories | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| pgsodium | decrypted_key | status | USER-DEFINED | YES | |
| public | achievements | description | text | YES | |
| public | students | guardian_email | text | YES | |
| storage | s3_multipart_uploads_parts | size | bigint | NO | 0 |
| auth | refresh_tokens | parent | character varying | YES | |
| auth | saml_relay_states | for_email | text | YES | |
| public | student_phonics_achievements | student_id | uuid | YES | |
| public | teachers | phone | text | YES | |
| vault | decrypted_secrets | name | text | YES | |
| auth | instances | id | uuid | NO | |
| public | story_pages | text | text | NO | |
| pgsodium | key | associated_data | text | YES | 'associated'::text |
| extensions | pg_stat_statements | shared_blks_read | bigint | YES | |
| public | story_recordings | pause_count | integer | YES | |
| auth | users | created_at | timestamp with time zone | YES | |
| extensions | pg_stat_statements_info | stats_reset | timestamp with time zone | YES | |
| public | story_recordings | status | text | NO | 'pending_analysis'::text |
| public | stories | theme_id | uuid | YES | |
| storage | buckets | created_at | timestamp with time zone | YES | now() |
| pgsodium | valid_key | name | text | YES | |
| public | student_achievements_old | earned_at | timestamp with time zone | YES | now() |
| public | phonics_achievements | points | integer | YES | 0 |
| public | story_themes | title | text | NO | |
| pgsodium | masking_rule | format_type | text | YES | |
| net | http_request_queue | url | text | NO | |
| pgsodium | decrypted_key | raw_key_nonce | bytea | YES | |
| pgsodium | decrypted_key | raw_key | bytea | YES | |
| storage | buckets | id | text | NO | |
| supabase_migrations | schema_migrations | name | text | YES | |
| storage | objects | path_tokens | ARRAY | YES | |
| public | schools | name | text | NO | |
| pgsodium | mask_columns | associated_columns | text | YES | |
| auth | users | phone_change_sent_at | timestamp with time zone | YES | |
| extensions | pg_stat_statements | local_blks_written | bigint | YES | |
| public | stories | language_type | USER-DEFINED | NO | 'pt-BR'::language_enum |
| auth | one_time_tokens | created_at | timestamp without time zone | NO | now() |
| auth | sessions | factor_id | uuid | YES | |
| extensions | pg_stat_statements | local_blks_dirtied | bigint | YES | |
| auth | users | phone_change_token | character varying | YES | ''::character varying |
| storage | s3_multipart_uploads_parts | version | text | NO | |
| public | story_themes | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | student_achievements_old | id | uuid | NO | uuid_generate_v4() |
| pgsodium | key | user_data | text | YES | |
| public | teacher_invites | school_id | uuid | NO | |
| public | stories | title | text | NO | |
| storage | s3_multipart_uploads | in_progress_size | bigint | NO | 0 |
| pgsodium | key | created | timestamp with time zone | NO | CURRENT_TIMESTAMP |
| public | achievement_types | description | text | YES | |
| realtime | subscription | subscription_id | uuid | NO | |
| public | student_achievements | earned_at | timestamp with time zone | YES | now() |
| auth | audit_log_entries | payload | json | YES | |
| storage | objects | last_accessed_at | timestamp with time zone | YES | now() |
| public | phonics_exercise_words | exercise_id | uuid | YES | |
| public | teacher_invites | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| public | story_characters | created_at | timestamp with time zone | NO | timezone('utc'::text, now()) |
| auth | mfa_factors | status | USER-DEFINED | NO | |
| pgsodium | decrypted_key | decrypted_raw_key | bytea | YES | |
| auth | instances | created_at | timestamp with time zone | YES | |
| storage | migrations | hash | character varying | NO | |
| public | story_recordings | error_message | text | YES | |
| public | story_pages | id | uuid | NO | uuid_generate_v4() |
| public | student_phonics_attempts | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | story_details | created_at | timestamp with time zone | YES | |
| extensions | pg_stat_statements | temp_blks_read | bigint | YES | |
| auth | saml_relay_states | id | uuid | NO | |
| storage | s3_multipart_uploads_parts | etag | text | NO | |
| auth | users | confirmed_at | timestamp with time zone | YES | |
| realtime | messages | id | uuid | NO | gen_random_uuid() |
| public | phonics_exercise_media | alt_text | text | YES | |
| net | http_request_queue | headers | jsonb | NO | |
| public | phonics_exercise_types | name | character varying | NO | |
| public | story_details | theme_id | uuid | YES | |
| public | student_phonics_attempt_answers | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | phonics_exercises | updated_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| public | story_recordings | strengths | ARRAY | YES | |
| auth | sso_domains | updated_at | timestamp with time zone | YES | |
| public | student_achievements_old | achievement_id | uuid | YES | |
| public | story_themes | description | text | NO | |
| auth | users | recovery_token | character varying | YES | |
| storage | buckets | owner | uuid | YES | |
| extensions | pg_stat_statements | stddev_plan_time | double precision | YES | |
| extensions | pg_stat_statements | jit_inlining_time | double precision | YES | |
| public | interests | student_id | uuid | NO | |
| supabase_migrations | schema_migrations | version | text | NO | |
| public | student_phonics_progress | total_time_spent_seconds | integer | YES | 0 |
| storage | migrations | id | integer | NO | |
| auth | users | reauthentication_token | character varying | YES | ''::character varying |
| public | story_pages | page_number | integer | NO | |
| extensions | pg_stat_statements | temp_blk_read_time | double precision | YES | |
| net | _http_response | status_code | integer | YES | |
| public | phonics_exercises | description | text | YES | |
| auth | saml_relay_states | request_id | text | NO | |
| storage | s3_multipart_uploads_parts | part_number | integer | NO | |
| realtime | schema_migrations | version | bigint | NO | |
| public | stories | id | uuid | NO | uuid_generate_v4() |
| extensions | pg_stat_statements | wal_records | bigint | YES | |
| auth | users | is_sso_user | boolean | NO | false |
| pgsodium | key | id | uuid | NO | gen_random_uuid() |
| public | story_characters | description | text | NO | |
| storage | objects | owner | uuid | YES | |
| auth | audit_log_entries | instance_id | uuid | YES | |
| public | phonics_categories | name | character varying | NO | |
| public | achievement_types | id | uuid | NO | uuid_generate_v4() |
| auth | users | raw_app_meta_data | jsonb | YES | |
| extensions | pg_stat_statements | stddev_exec_time | double precision | YES | |
| public | student_phonics_progress | best_score | double precision | YES | 0 |
| auth | saml_relay_states | created_at | timestamp with time zone | YES | |
| public | achievements | id | uuid | NO | uuid_generate_v4() |
| pgsodium | masking_rule | key_id_column | text | YES | |
| storage | s3_multipart_uploads_parts | id | uuid | NO | gen_random_uuid() |
| auth | identities | user_id | uuid | NO | |
| public | story_pages | image_path | text | YES | |
| auth | saml_providers | metadata_url | text | YES | |
| auth | instances | raw_base_config | text | YES | |
| storage | migrations | executed_at | timestamp without time zone | YES | CURRENT_TIMESTAMP |
| extensions | pg_stat_statements | rows | bigint | YES | |
| auth | users | raw_user_meta_data | jsonb | YES | |
| pgsodium | key | expires | timestamp with time zone | YES | |
| public | student_achievements | achievement_id | uuid | YES | |
| public | achievement_types | created_at | timestamp with time zone | YES | CURRENT_TIMESTAMP |
| storage | objects | id | uuid | NO | gen_random_uuid() |
| auth | audit_log_entries | created_at | timestamp with time zone | YES | |
| public | story_characters | id | uuid | NO | uuid_generate_v4() |
| vault | secrets | key_id | uuid | YES | (pgsodium.create_key()).id |
| auth | users | deleted_at | timestamp with time zone | YES | |
| public | story_subjects | icon | text | NO | |
| storage | buckets | allowed_mime_types | ARRAY | YES | |
| extensions | pg_stat_statements | wal_fpi | bigint | YES | |
| auth | users | recovery_sent_at | timestamp with time zone | YES | |
| extensions | pg_stat_statements | mean_plan_time | double precision | YES | |
| extensions | pg_stat_statements | calls | bigint | YES | |
| auth | users | confirmation_sent_at | timestamp with time zone | YES | |
| auth | refresh_tokens | created_at | timestamp with time zone | YES | |
| public | story_recordings | comprehension_score | integer | YES | |
| auth | saml_relay_states | flow_state_id | uuid | YES | |
| public | story_themes | id | uuid | NO | uuid_generate_v4() |
| public | student_phonics_progress | total_answers_count | integer | YES | 0 |
| public | students | guardian_name | text | YES | |
| public | story_pages | image_url_medium | text | YES | |
| net | http_request_queue | id | bigint | NO | nextval('net.http_request_queue_id_seq'::regclass) |
| extensions | pg_stat_statements | dbid | oid | YES | |
| auth | users | id | uuid | NO | |
| auth | mfa_challenges | ip_address | inet | NO | |
| storage | buckets | avif_autodetection | boolean | YES | false |
| public | classes | year | integer | NO | |

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,91 @@
| policy_id | schema_name | table_name | policy_name | command | policy_using | policy_check |
| --------- | ----------- | ---------------------- | ------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| 29823 | auth | users | Validate user metadata | * | (((raw_user_meta_data ->> 'role'::text))::user_role IS NOT NULL) | |
| 29615 | public | classes | Schools can create classes | a | | (school_id = auth.uid()) |
| 29616 | public | classes | Schools can update their classes | w | (school_id = auth.uid()) | (school_id = auth.uid()) |
| 29614 | public | classes | Schools can view their classes | r | (school_id = auth.uid()) | |
| 29301 | public | classes | Turmas visíveis para usuários autenticados | r | true | |
| 65878 | public | interests | Students can delete their own interests | d | (auth.uid() = student_id) | |
| 65876 | public | interests | Students can insert their own interests | a | | (auth.uid() = student_id) |
| 65877 | public | interests | Students can update their own interests | w | (auth.uid() = student_id) | (auth.uid() = student_id) |
| 65875 | public | interests | Students can view their own interests | r | (auth.uid() = student_id) | |
| 79931 | public | phonics_categories | Permitir leitura de categorias fonéticas para usuários autent | r | true | |
| 79932 | public | phonics_exercise_types | Permitir leitura de tipos de exercícios fonéticos para usuár | r | true | |
| 79934 | public | phonics_exercise_words | Permitir leitura de relações exercício-palavra para usuário | r | true | |
| 79930 | public | phonics_exercises | Permitir leitura de exercícios fonéticos para usuários auten | r | true | |
| 79933 | public | phonics_words | Permitir leitura de palavras fonéticas para usuários autentic | r | true | |
| 29440 | public | schools | Enable insert for registration | a | | true |
| 29299 | public | schools | Escolas visíveis para usuários autenticados | r | true | |
| 29442 | public | schools | Schools can update own data | w | (auth.uid() = id) | (auth.uid() = id) |
| 29441 | public | schools | Schools can view own data | r | (auth.uid() = id) | |
| 29347 | public | stories | Alunos podem atualizar suas próprias histórias | w | (student_id IN ( SELECT students.id
FROM students
WHERE (students.email = auth.email()))) | |
| 29346 | public | stories | Alunos podem criar suas próprias histórias | a | | (student_id IN ( SELECT students.id
FROM students
WHERE (students.email = auth.email()))) |
| 36241 | public | stories | Estudantes podem ver suas próprias histórias | r | ((auth.uid() = student_id) AND (EXISTS ( SELECT 1
FROM story_themes
WHERE ((story_themes.id = stories.theme_id) AND (story_themes.active = true)))) AND (EXISTS ( SELECT 1
FROM story_subjects
WHERE ((story_subjects.id = stories.subject_id) AND (story_subjects.active = true)))) AND (EXISTS ( SELECT 1
FROM story_characters
WHERE ((story_characters.id = stories.character_id) AND (story_characters.active = true)))) AND (EXISTS ( SELECT 1
FROM story_settings
WHERE ((story_settings.id = stories.setting_id) AND (story_settings.active = true))))) | |
| 29345 | public | stories | Histórias visíveis para usuários autenticados | r | true | |
| 53384 | public | stories | Permitir deleção pelo dono | d | (auth.uid() = student_id) | |
| 34952 | public | story_characters | Permitir leitura pública dos personagens | r | (active = true) | |
| 53955 | public | story_exercise_words | Apenas sistema pode inserir | a | | (auth.role() = 'service_role'::text) |
| 53954 | public | story_exercise_words | Leitura pública das palavras | r | true | |
| 37664 | public | story_generations | Apenas service_role pode inserir metadados | a | | true |
| 37663 | public | story_generations | Metadados são visíveis para todos | r | true | |
| 37662 | public | story_pages | Apenas service_role pode inserir páginas | a | | true |
| 37661 | public | story_pages | Páginas são visíveis para todos | r | true | |
| 31560 | public | story_recordings | Escolas podem ver todas as gravações | r | (EXISTS ( SELECT 1
FROM students s
WHERE ((s.id = story_recordings.student_id) AND (s.school_id = auth.uid())))) | |
| 30092 | public | story_recordings | Estudantes podem gravar áudios | a | | (auth.uid() = student_id) |
| 31511 | public | story_recordings | Estudantes podem ver suas próprias gravações | r | (auth.uid() = student_id) | |
| 31558 | public | story_recordings | Professores podem ver gravações de seus alunos | r | (EXISTS ( SELECT 1
FROM (classes c
JOIN students s ON ((s.class_id = c.id)))
WHERE ((s.id = story_recordings.student_id) AND (c.teacher_id = auth.uid())))) | |
| 29748 | public | story_recordings | Students can insert their own recordings | a | | (auth.uid() = student_id) |
| 29749 | public | story_recordings | Students can view their own recordings | r | (auth.uid() = student_id) | |
| 34953 | public | story_settings | Permitir leitura pública dos cenários | r | (active = true) | |
| 34951 | public | story_subjects | Permitir leitura pública das disciplinas | r | (active = true) | |
| 34950 | public | story_themes | Permitir leitura pública das categorias | r | (active = true) | |
| 29302 | public | students | Alunos visíveis para usuários autenticados | r | true | |
| 29638 | public | students | Escolas podem inserir seus próprios alunos | a | | (auth.uid() IN ( SELECT schools.id
FROM schools
WHERE (schools.id = students.school_id))) |
| 29639 | public | students | Escolas podem ver seus próprios alunos | r | (auth.uid() IN ( SELECT schools.id
FROM schools
WHERE (schools.id = students.school_id))) | |
| 29584 | public | students | Schools can view their students | r | (school_id = auth.uid()) | |
| 29511 | public | teacher_invites | Schools can invite teachers | a | | (school_id IN ( SELECT schools.id
FROM schools
WHERE (schools.id = auth.uid()))) |
| 29300 | public | teachers | Professores visíveis para usuários autenticados | r | true | |
| 29510 | public | teachers | Schools can view their teachers | r | (school_id IN ( SELECT schools.id
FROM schools
WHERE (schools.id = auth.uid()))) | |
| 29509 | public | teachers | Teachers can view own data | r | (auth.uid() = id) | |
| 29717 | storage | objects | Anyone can read recordings | r | (bucket_id = 'recordings'::text) | |
| 30136 | storage | objects | Estudantes podem fazer upload de áudios | a | | ((bucket_id = 'recordings'::text) AND ((auth.uid())::text = (storage.foldername(name))[1])) |
| 75352 | storage | objects | Imagens são publicamente acessíveis | r | (bucket_id = 'story-images'::text) | |
| 43940 | storage | objects | Permitir acesso da Edge Function | r | ((bucket_id = 'recordings'::text) AND ((auth.jwt() ->> 'role'::text) = 'service_role'::text)) | |
| 52098 | storage | objects | Permitir acesso público para leitura | r | (bucket_id = 'recordings'::text) | |
| 37570 | storage | objects | Permitir acesso público para leitura de imagens de histórias | r | (bucket_id = 'story-images'::text) | |
| 37573 | storage | objects | Permitir delete pela edge function | d | (bucket_id = 'story-images'::text) | |
| 53468 | storage | objects | Permitir deleção de imagens pelo dono da história | d | ((bucket_id = 'story-images'::text) AND (EXISTS ( SELECT 1
FROM stories s
WHERE ((s.id = ((storage.foldername(objects.name))[1])::uuid) AND (s.student_id = auth.uid()))))) | |
| 53426 | storage | objects | Permitir deleção pelo dono do arquivo | d | ((bucket_id = 'recordings'::text) AND ((storage.foldername(name))[1] = (auth.uid())::text)) | |
| 52099 | storage | objects | Permitir download público | r | (bucket_id = 'recordings'::text) | |
| 37572 | storage | objects | Permitir update pela edge function | w | (bucket_id = 'story-images'::text) | |
| 43939 | storage | objects | Permitir upload de áudios autenticado | a | | ((bucket_id = 'recordings'::text) AND (auth.role() = 'authenticated'::text)) |
| 37571 | storage | objects | Permitir upload pela edge function | a | | (bucket_id = 'story-images'::text) |
| 29716 | storage | objects | Students can upload their recordings | a | | ((bucket_id = 'recordings'::text) AND (auth.role() = 'student'::text)) |
| 74045 | storage | objects | Áudios públicos | r | (bucket_id = 'phonics-audio'::text) | |

View File

@ -12,17 +12,24 @@ interface StoryPrompt {
character_id: string;
setting_id: string;
context?: string;
language_type: string;
difficulty: 'easy' | 'medium' | 'hard';
}
interface EnhancedPayload {
// Campos existentes
interface StoryPayload {
story_id: string;
student_id: string;
theme_id: string;
subject_id: string;
character_id: string;
setting_id: string;
language_type: string;
theme?: string;
subject?: string;
character?: string;
setting?: string;
context?: string;
voice_context?: string;
audio_metadata?: {
duration: number;
sample_rate: number;
language: string;
};
}
const ALLOWED_ORIGINS = [
@ -70,53 +77,57 @@ serve(async (req) => {
return new Response('ok', { headers: corsHeaders })
}
const { voice_context, ...rest } = await req.json()
console.log('[Request]', rest)
const payload = await req.json() as StoryPayload;
console.log('[Request] Payload recebido:', payload);
try {
const supabase = createClient(
Deno.env.get('SUPABASE_URL') ?? '',
Deno.env.get('SUPABASE_SERVICE_ROLE_KEY') ?? ''
)
console.log('[Supabase] Cliente inicializado')
);
console.log('[Supabase] Cliente inicializado');
console.log('[DB] Buscando categorias...')
if (!payload.story_id) {
throw new Error('ID da história não fornecido');
}
console.log('[DB] Buscando categorias...');
const [themeResult, subjectResult, characterResult, settingResult] = await Promise.all([
supabase.from('story_themes').select('*').eq('id', rest.theme_id).single(),
supabase.from('story_subjects').select('*').eq('id', rest.subject_id).single(),
supabase.from('story_characters').select('*').eq('id', rest.character_id).single(),
supabase.from('story_settings').select('*').eq('id', rest.setting_id).single()
])
supabase.from('story_themes').select('*').eq('id', payload.theme_id).single(),
supabase.from('story_subjects').select('*').eq('id', payload.subject_id).single(),
supabase.from('story_characters').select('*').eq('id', payload.character_id).single(),
supabase.from('story_settings').select('*').eq('id', payload.setting_id).single()
]);
console.log('[DB] Resultados das consultas:', {
theme: themeResult,
subject: subjectResult,
character: characterResult,
setting: settingResult
})
});
if (themeResult.error) throw new Error(`Erro ao buscar tema: ${themeResult.error.message}`);
if (subjectResult.error) throw new Error(`Erro ao buscar disciplina: ${subjectResult.error.message}`);
if (characterResult.error) throw new Error(`Erro ao buscar personagem: ${characterResult.error.message}`);
if (settingResult.error) throw new Error(`Erro ao buscar cenário: ${settingResult.error.message}`);
if (!themeResult.data) throw new Error(`Tema não encontrado: ${rest.theme_id}`);
if (!subjectResult.data) throw new Error(`Disciplina não encontrada: ${rest.subject_id}`);
if (!characterResult.data) throw new Error(`Personagem não encontrado: ${rest.character_id}`);
if (!settingResult.data) throw new Error(`Cenário não encontrado: ${rest.setting_id}`);
if (!themeResult.data) throw new Error(`Tema não encontrado: ${payload.theme_id}`);
if (!subjectResult.data) throw new Error(`Disciplina não encontrada: ${payload.subject_id}`);
if (!characterResult.data) throw new Error(`Personagem não encontrado: ${payload.character_id}`);
if (!settingResult.data) throw new Error(`Cenário não encontrado: ${payload.setting_id}`);
const theme = themeResult.data;
const subject = subjectResult.data;
const character = characterResult.data;
const setting = settingResult.data;
console.log('[Validation] Categorias validadas com sucesso')
console.log('[Validation] Categorias validadas com sucesso');
console.log('[GPT] Construindo prompt...')
const prompt = buildPrompt(rest, voice_context);
console.log('[GPT] Prompt construído:', prompt)
console.log('[GPT] Construindo prompt...');
const prompt = buildPrompt(payload, payload.voice_context);
console.log('[GPT] Prompt construído:', prompt);
console.log('[GPT] Iniciando geração da história...')
console.log('[GPT] Iniciando geração da história...');
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
@ -125,15 +136,16 @@ serve(async (req) => {
content: "Você é um contador de histórias infantis especializado em conteúdo educativo."
},
{
role: "user",
role: "user",
content: prompt
}
],
temperature: 0.7,
max_tokens: 1000
})
max_tokens: 1000,
response_format: { type: "json_object" }
});
console.log('[GPT] História gerada:', completion.choices[0].message)
console.log('[GPT] História gerada:', completion.choices[0].message);
const storyContent = JSON.parse(completion.choices[0].message.content || '{}') as StoryResponse;
// Validar estrutura do retorno da IA
@ -142,10 +154,10 @@ serve(async (req) => {
throw new Error('Formato inválido retornado pela IA');
}
console.log('[DALL-E] Iniciando geração de imagens...')
console.log('[DALL-E] Iniciando geração de imagens...');
const pages = await Promise.all(
storyContent.content.pages.map(async (page, index) => {
console.log(`[DALL-E] Gerando imagem ${index + 1}/${storyContent.content.pages.length}...`)
console.log(`[DALL-E] Gerando imagem ${index + 1}/${storyContent.content.pages.length}...`);
// Gerar imagem com DALL-E
const imageResponse = await openai.images.generate({
@ -153,52 +165,52 @@ serve(async (req) => {
n: 1,
size: "1024x1024",
model: "dall-e-3"
})
});
// Baixar a imagem do URL do DALL-E
console.log(`[Storage] Baixando imagem ${index + 1}...`)
const imageUrl = imageResponse.data[0].url
const imageRes = await fetch(imageUrl)
const imageBuffer = await imageRes.arrayBuffer()
console.log(`[Storage] Baixando imagem ${index + 1}...`);
const imageUrl = imageResponse.data[0].url;
const imageRes = await fetch(imageUrl);
const imageBuffer = await imageRes.arrayBuffer();
// Gerar nome único para o arquivo
const fileName = `${rest.id}/page-${index + 1}-${Date.now()}.png`
const fileName = `${payload.story_id}/page-${index + 1}-${Date.now()}.png`;
// Salvar no Storage do Supabase
console.log(`[Storage] Salvando imagem ${index + 1} no bucket...`)
const { data: storageData, error: storageError } = await supabase
console.log(`[Storage] Salvando imagem ${index + 1} no bucket...`);
const { error: storageError } = await supabase
.storage
.from('story-images')
.upload(fileName, imageBuffer, {
contentType: 'image/png',
cacheControl: '3600',
upsert: false
})
});
if (storageError) {
throw new Error(`Erro ao salvar imagem ${index + 1} no storage: ${storageError.message}`)
throw new Error(`Erro ao salvar imagem ${index + 1} no storage: ${storageError.message}`);
}
// Gerar URL público da imagem sem transformações
const { data: publicUrl } = supabase
.storage
.from('story-images')
.getPublicUrl(fileName)
.getPublicUrl(fileName);
console.log(`[Storage] Imagem ${index + 1} salva com sucesso`)
console.log(`[Storage] Imagem ${index + 1} salva com sucesso`);
return {
text: page.text,
image: publicUrl.publicUrl, // Salvar apenas o caminho do arquivo
image_path: fileName
}
};
})
)
);
console.log('[DALL-E] Todas as imagens geradas com sucesso')
console.log('[DALL-E] Todas as imagens geradas com sucesso');
// Preparar e salvar os dados
const { data: story, error: storyError } = await supabase
const { error: storyError } = await supabase
.from('stories')
.update({
title: storyContent.title,
@ -207,10 +219,10 @@ serve(async (req) => {
subject_id: subject.id,
character_id: character.id,
setting_id: setting.id,
context: rest.context,
context: payload.voice_context || payload.context || '',
updated_at: new Date().toISOString()
})
.eq('id', rest.id)
.eq('id', payload.story_id)
.select()
.single();
@ -221,7 +233,7 @@ serve(async (req) => {
.from('story_pages')
.insert(
pages.map((page, index) => ({
story_id: rest.id,
story_id: payload.story_id,
page_number: index + 1,
text: page.text,
image_url: page.image,
@ -235,7 +247,7 @@ serve(async (req) => {
const { error: genError } = await supabase
.from('story_generations')
.insert({
story_id: rest.id,
story_id: payload.story_id,
original_prompt: prompt,
ai_response: completion.choices[0].message.content,
model_used: 'gpt-4o-mini'
@ -250,7 +262,7 @@ serve(async (req) => {
*,
pages:story_pages(*)
`)
.eq('id', rest.id)
.eq('id', payload.story_id)
.single();
if (fetchError) throw new Error(`Erro ao buscar história completa: ${fetchError.message}`);
@ -267,7 +279,7 @@ serve(async (req) => {
if (!pageWithWord) return null;
return {
story_id: rest.id,
story_id: payload.story_id,
word,
exercise_type: type,
phonemes: pageWithWord?.phonemes || null,
@ -280,7 +292,10 @@ serve(async (req) => {
if (exerciseWords.length > 0) {
const { error: wordsError } = await supabase
.from('story_exercise_words')
.insert(exerciseWords);
.insert(exerciseWords.map(word => ({
...word,
story_id: payload.story_id
})));
if (wordsError) {
console.error('Erro ao salvar palavras dos exercícios:', wordsError);
@ -298,8 +313,8 @@ serve(async (req) => {
);
} catch (error) {
console.error('[Error] Erro ao gerar história:', error)
console.error('[Error] Stack trace:', error.stack)
console.error('[Error] Erro ao gerar história:', error);
console.error('[Error] Stack trace:', error.stack);
return new Response(
JSON.stringify({
@ -311,11 +326,28 @@ serve(async (req) => {
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
status: 500
}
)
);
}
})
});
function buildPrompt(base: StoryPrompt, voice?: string) {
const languageInstructions = {
'pt-BR': {
language: 'português do Brasil',
instructions: 'Use linguagem apropriada para crianças brasileiras'
},
'en-US': {
language: 'English (US)',
instructions: 'Use language appropriate for American children'
},
'es-ES': {
language: 'español de España',
instructions: 'Usa un lenguaje apropiado para niños españoles'
}
};
const selectedLanguage = languageInstructions[base.language_type as keyof typeof languageInstructions] || languageInstructions['pt-BR'];
return `
Crie uma história educativa para crianças com as seguintes características:
@ -323,18 +355,21 @@ function buildPrompt(base: StoryPrompt, voice?: string) {
Disciplina: ${base.subject_id}
Personagem Principal: ${base.character_id}
Cenário: ${base.setting_id}
Idioma: ${selectedLanguage.language}
${base.context ? `Contexto Adicional: ${base.context}` : ''}
Requisitos:
- História adequada para crianças de 6-12 anos
- Conteúdo educativo focado em ${base.subject_id}
- ${selectedLanguage.instructions}
- Linguagem clara e envolvente
- 3-5 páginas de conteúdo
- 3-8 páginas de conteúdo
- Cada página deve ter um texto curto e sugestão para uma imagem
- Evitar conteúdo sensível ou inadequado
- Incluir elementos de ${base.theme_id}
- Ambientado em ${base.setting_id}
- Personagem principal baseado em ${base.character_id}
- A resposta precisa ser em JSON
Requisitos específicos para exercícios:
1. Para o exercício de completar frases:
@ -353,7 +388,7 @@ function buildPrompt(base: StoryPrompt, voice?: string) {
- Inclua palavras com encontros consonantais
- Priorize palavras que sejam desafiadoras para a faixa etária
Formato da resposta:
Formato da resposta em JSON:
{
"title": "Título da História",
"content": {

2697
types.ts Normal file

File diff suppressed because it is too large Load Diff