-- Run in Supabase SQL editor (once). Projects for Office Management System.

create table if not exists public.projects (
  id text primary key,
  project_name text not null,
  start_date date,
  deadline date,
  weightage text,
  notes text,
  client_name text,
  client_source text,
  client_contact text,
  team_lead_ids jsonb not null default '[]'::jsonb,
  assigned_member_ids jsonb not null default '[]'::jsonb,
  project_status text not null default 'active',
  closed_at bigint,
  created_at timestamptz not null default now(),
  updated_at timestamptz not null default now()
);

create index if not exists projects_updated_at_idx on public.projects (updated_at desc);
