// What `db:push` creates.
//
// This barrel is drizzle-kit's view of the schema — `drizzle.config.ts` points `schema` straight at
// this file. It is NOT the runtime's view: every query imports its table object from the schema file
// directly and calls `db.select().from(table)`, and nothing uses drizzle's relational API (`db.query.X`),
// which is the only thing the `schema` passed to `drizzle()` in db.ts is for.
//
// So a commented line here removes a table from the DATABASE without removing a line of code. That is
// deliberate and it is what makes the split below possible.
//
// ── Core, and plugins ──
//
// A fresh install creates the core tables only. Everything under "plugins" belongs to a sidecar a
// baseline install does not run.
//
// A plugin's tables are NOT among them any more: a plugin owns its schema at
// `plugins/<name>/db/schema.ts`, and installing it regenerates `plugin-schemas.gen.ts` (imported at the
// bottom of this file) and runs `db:push`. Offscale was the first out, on 2026-08-15.
//
// The commented lines below are kept rather than deleted. They record what each remaining sidecar's
// tables are called and which file defines them — which is exactly what each one needs when its turn to
// be extracted comes.

// ── Core ─────────────────────────────────────────────────────────────────────────────────────────

export * from './auth/schema'; // users, passkeys, passkey_challenges, token_blacklist
export * from './capabilities/schema'; // role_capabilities — what each ROLE may reach
export * from './api-keys/schema'; // api_keys
export * from './user-data/schema'; // user_settings, user_state, user_integrations, dock_configs
export * from './dashboards/schema'; // dashboards, screens, dashboard_defaults
export * from './server/schema'; // server_config (SMTP lives here), server_integrations
export * from './pipeline-jobs/schema'; // pipeline_jobs
export * from './chat-events/schema'; // chat_session_events
export * from './agent-panels/schema'; // agent_panels

// Core because the tailnet is the perimeter — a security model resting on it cannot treat administering

// The app store itself, and the credentials it stores for what it installs. `app-store/effects.ts`
// reads service_connections, so this is core however few plugins are installed.
export * from './app-store/schema'; // sidecar_installs
export * from './plugins/schema'; // plugin_installs — core: the plugin system is the platform's own
export * from './service-connections/schema'; // service_connections

// ── Plugins — uncomment when the plugin is installed ─────────────────────────────────────────────

// export * from './email/schema';         // email_accounts                                   officer-email
// export * from './notify/schema';        // push_devices                                     officer-notify
// export * from './dav/schema';           // dav_app_passwords                                officer-caldav
// export * from './photos/schema';        // photos_config                                    officer-photos
// export * from './jellyfin/schema';      // jellyfin_servers                                 officer-jellyfin
// export * from './invoiceshelf/schema';  // invoiceshelf_accounts                            officer-invoiceshelf
// export * from './soulseek/schema';      // soulseek_favorites, _browse_snapshots, _browse_dirs
// export * from './vault/schema';         // vault_tokens, vault_unlock_keys                  officer-vault
// export * from './wallet/schema';        // wallet_wallets, _labels, _frozen_utxos, _chain_cache

// ── Plugin tables ────────────────────────────────────────────────────────────────────────────────
//
// Generated from the plugin DIRECTORIES on disk (servers/plugins/schema.ts), not from what is installed.
// push drops what it cannot see, so following the install table would delete a plugin's tables the moment
// it was uninstalled. Following the directory means uninstall keeps every row and only deleting a
// plugin's source can lose data.
export * from './plugin-schemas.gen';
