alter table if exists uploaded_files
  add column if not exists bucket text not null default '',
  add column if not exists checksum text not null default '',
  add column if not exists visibility text not null default 'private',
  add column if not exists owner_type text not null default '',
  add column if not exists owner_id text not null default '';

insert into uploaded_files (
  id,
  file_name,
  mime_type,
  file_size,
  content_base64,
  storage_driver,
  object_key,
  storage_path,
  visibility,
  owner_type,
  owner_id
)
values (
  'd1b1d1b1-2026-4000-9000-000000000001',
  'dlbdi-logo.jpg',
  'image/jpeg',
  5506,
  '',
  'pending',
  '',
  '',
  'public',
  'site_asset',
  'brand_logo'
)
on conflict (id) do update set
  file_name = excluded.file_name,
  mime_type = excluded.mime_type,
  file_size = excluded.file_size,
  content_base64 = excluded.content_base64,
  storage_driver = excluded.storage_driver,
  object_key = excluded.object_key,
  storage_path = excluded.storage_path,
  visibility = excluded.visibility,
  owner_type = excluded.owner_type,
  owner_id = excluded.owner_id;
