Now we’ll create the database table for our posts application. Since Supabase handles user authentication automatically, we only need to create a table for our application data.

Creating the Posts Table

In the Supabase menu, select Database.

  1. Click “Create a new table”.
  2. Table name: posts.
  3. Leave Enable Row Level Security (RLS) checked.
  4. Add columns (Add column button):
    • id: int8, primary key (auto-created).
    • created_at: timestamptz, default now() (auto-created).
    • title: text, not null.
    • content: text, not null.
    • user_id: uuid, auth.uid() (select this from the Suggested expressions menu button).
  5. Save the table.

Tags: