寶鴻

首次設定 Supabase

開源資料庫,資料由你掌控

設定步驟(約 10 分鐘)
1. 前往 supabase.com → 免費註冊 → 建立新專案
2. 左側 → SQL Editor → New query → 貼入以下 SQL 並執行:
create table if not exists ar_projects (
  id text primary key,
  user_id uuid references auth.users(id)
    on delete cascade not null,
  data jsonb not null default '{}',
  created_at bigint not null default 0
);
create table if not exists ar_requests (
  id text primary key,
  user_id uuid references auth.users(id)
    on delete cascade not null,
  project_id text not null,
  data jsonb not null default '{}',
  due_date bigint not null default 0
);
alter table ar_projects enable row level security;
alter table ar_requests enable row level security;
create policy "own" on ar_projects
  for all using (auth.uid() = user_id);
create policy "own" on ar_requests
  for all using (auth.uid() = user_id);
alter table ar_projects replica identity full;
alter table ar_requests replica identity full;
alter publication supabase_realtime
  add table ar_projects, ar_requests;
3. 左側 → Authentication → Sign In / Up → Email → 把「Confirm email」關掉(方便測試)
4. 左側 → Project Settings → API → 複製「Project URL」和「anon / public key」填入下方
寶鴻

應收帳款管理

寶鴻防水防熱材料股份有限公司