handré laubscher
Writing desk · Loading
handré laubscher
Writing desk
No account? Create one
Pin this post to the top of the grid
Stats caps
Views grow gradually toward this number
Featured image
Click or drop image here
Uploads to Supabase storage
Options
All published writing
Connection & account
Project: mqgutltvdwqhmkjgzyqs.supabase.co
Your Supabase project needs the following tables. Run this SQL in the Supabase SQL editor if you haven't already.
-- blog_posts: your articles
create table if not exists blog_posts (
id bigserial primary key,
title text not null,
subtitle text,
category text,
excerpt text,
content text,
featured_image_url text,
reading_time int default 5,
featured boolean default false,
view_cap int default 5000,
like_cap int default 200,
created_at timestamptz default now()
);
-- post_stats: growing view/like counts per post
create table if not exists post_stats (
id bigserial primary key,
post_id text not null unique,
views int default 0,
likes int default 0,
last_grown timestamptz default now()
);
-- comments: reader comments
create table if not exists comments (
id bigserial primary key,
post_id text not null,
author_name text not null,
author_email text,
body text not null,
created_at timestamptz default now()
);
-- Enable Row Level Security + public read policies
alter table blog_posts enable row level security;
alter table post_stats enable row level security;
alter table comments enable row level security;
create policy "Public read posts" on blog_posts for select using (true);
create policy "Public read stats" on post_stats for select using (true);
create policy "Public read comments" on comments for select using (true);
create policy "Public insert stats" on post_stats for insert with check (true);
create policy "Public insert comments" on comments for insert with check (true);
create policy "Public update stats" on post_stats for update using (true);
-- Storage bucket for blog images (create in Storage UI or via:)
-- insert into storage.buckets (id, name, public) values ('blog-images', 'blog-images', true);
Signed in as: —