timtbdev/Next.js-Blog-App

sql file

Opened this issue · 1 comments

Rstacx commented
{
  code: '23503',
  details: 'Key (author_id)=(ffa6add6-903f-4265-956e-388065b67e14) is not present in table "profiles".',
  hint: null,
  message: 'insert or update on table "drafts" violates foreign key constraint "drafts_author_id_fkey"'
}

Can you give me the updated sql?

{
  code: '23503',
  details: 'Key (author_id)=(ffa6add6-903f-4265-956e-388065b67e14) is not present in table "profiles".',
  hint: null,
  message: 'insert or update on table "drafts" violates foreign key constraint "drafts_author_id_fkey"'
}

Can you give me the updated sql?

The sql file is missing the author id column and the status column.

create table
  public.drafts (
    id uuid not null default gen_random_uuid (),
    category_id uuid null,
    title text null default 'Untitled'::text,
    slug text null default 'untitled'::text,
    image text null,
    description text null,
    content text null,
    created_at timestamp with time zone not null default now(),
    updated_at timestamp without time zone null,
    author_id uuid null,
    published boolean null default false,
    status text null default 'draft'::text,
    constraint drafts_pkey primary key (id),
    constraint drafts_author_id_fkey foreign key (author_id) references profiles (id),
    constraint drafts_category_id_fkey foreign key (category_id) references categories (id) on delete cascade
  ) tablespace pg_default;