LOADING...

選擇使用者

出車資訊
出發前車況確認

各使用者

新增使用者
Supabase 設定
SQL 初始化腳本

請在 Supabase → SQL Editor 執行以下 SQL 建立資料表:

-- 使用者資料表
CREATE TABLE users (
  id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
  name text NOT NULL,
  color text NOT NULL,
  text_color text NOT NULL,
  created_at timestamptz DEFAULT now()
);

-- 里程記錄資料表
CREATE TABLE records (
  id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
  user_name text NOT NULL,
  status text DEFAULT 'pending',
  dep_time timestamptz,
  dep_km numeric,
  dep_loc text,
  purpose text,
  checks text[],
  arr_time timestamptz,
  arr_km numeric,
  arr_loc text,
  refuel boolean DEFAULT false,
  fuel_liter numeric DEFAULT 0,
  fuel_cost numeric DEFAULT 0,
  created_at timestamptz DEFAULT now()
);

-- 開放讀寫(無驗證需求)
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
ALTER TABLE records ENABLE ROW LEVEL SECURITY;
CREATE POLICY "public_all" ON users FOR ALL USING (true) WITH CHECK (true);
CREATE POLICY "public_all" ON records FOR ALL USING (true) WITH CHECK (true);