⚙️ Supabase セットアップ
初回のみ設定が必要です。Supabase の無料アカウントを作成してプロジェクト情報を入力してください。
Step 1 — Supabase プロジェクト作成
supabase.com でアカウント作成 → 新規プロジェクト作成 → Settings > API から Project URL と anon public key をコピー
Step 2 — SQL Editor でテーブル作成
create table profiles (
id uuid references auth.users on delete cascade primary key,
company_name text, company_address text, company_phone text,
tax_id text, invoice_prefix text default 'INV',
invoice_next integer default 1, bank_info text,
updated_at timestamptz default now()
);
alter table profiles enable row level security;
create policy "own profile" on profiles for all using (auth.uid() = id);
create table projects (
id uuid default gen_random_uuid() primary key,
user_id uuid references auth.users on delete cascade not null,
name text not null, client_name text,
hourly_rate integer default 0, status text default 'active',
color text default '#0ea5e9', created_at timestamptz default now()
);
alter table projects enable row level security;
create policy "own projects" on projects for all using (auth.uid() = user_id);
create table time_entries (
id uuid default gen_random_uuid() primary key,
user_id uuid references auth.users on delete cascade not null,
project_id uuid references projects on delete set null,
description text, started_at timestamptz not null,
ended_at timestamptz, duration_seconds integer,
created_at timestamptz default now()
);
alter table time_entries enable row level security;
create policy "own time entries" on time_entries for all using (auth.uid() = user_id);
create table invoices (
id uuid default gen_random_uuid() primary key,
user_id uuid references auth.users on delete cascade not null,
invoice_number text not null, client_name text, client_address text,
items jsonb default '[]', subtotal integer default 0,
tax_rate integer default 10, tax_amount integer default 0,
total integer default 0, status text default 'draft',
issued_date date, due_date date, notes text,
created_at timestamptz default now()
);
alter table invoices enable row level security;
create policy "own invoices" on invoices for all using (auth.uid() = user_id);