2026-04-16 14:20:00 +02:00

30 lines
1.1 KiB
SQL

-- 0005_agenda.sql — Phase 4
-- Événements calendrier (source locale ou sync Google) + token OAuth Google (single-row).
set search_path to ordinarthur_os, public;
create table if not exists ordinarthur_os.calendar_events (
id uuid primary key default gen_random_uuid(),
google_event_id text unique,
title text not null,
description text,
location text,
starts_at timestamptz not null,
ends_at timestamptz not null,
all_day boolean not null default false,
source text not null default 'ordinarthur-os',
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index if not exists calendar_events_starts_at_idx
on ordinarthur_os.calendar_events(starts_at);
-- Single-row pour Arthur (id forcé à 1 par le check)
create table if not exists ordinarthur_os.google_oauth_tokens (
id smallint primary key default 1 check (id = 1),
access_token text not null,
refresh_token text not null,
expires_at timestamptz not null,
calendar_id text
);