Skip to main content

systemprompt_database/models/
info.rs

1//! Descriptors for databases, tables, columns, and indexes.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct DatabaseInfo {
10    pub path: String,
11    pub size: u64,
12    pub version: String,
13    pub tables: Vec<TableInfo>,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct TableInfo {
18    pub name: String,
19    pub row_count: i64,
20    #[serde(default)]
21    pub size_bytes: i64,
22    pub columns: Vec<ColumnInfo>,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct ColumnInfo {
27    pub name: String,
28    pub data_type: String,
29    pub nullable: bool,
30    pub primary_key: bool,
31    pub default: Option<String>,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct IndexInfo {
36    pub name: String,
37    pub columns: Vec<String>,
38    pub unique: bool,
39}