Overview
Poge provides comprehensive TypeScript interfaces for representing PostgreSQL database objects including schemas, tables, views, columns, indexes, and constraints.Core Object Types
DatabaseInfo
Represents a database with its schema structure. From/types/database.ts:1-4:
Database name
Array of schemas in the database
SchemaInfo
Represents a database schema containing tables and views. From/types/database.ts:6-9:
Schema name (e.g.,
"public", "myschema")Array of tables and views in the schema
TableInfo
Represents a table, view, or materialized view. From/types/database.ts:11-19:
Table or view name
Object type:
"table"- Regular table"view"- View"materialized_view"- Materialized view
Parent schema name
Estimated row count (from
pg_class.reltuples)Number of columns in the table
Table size as human-readable string (e.g.,
"1.5 MB")Table creation timestamp
ColumnInfo
Represents a table column with its metadata. From/types/database.ts:21-27:
Column name
PostgreSQL data type (e.g.,
"integer", "varchar", "timestamp without time zone")Whether the column accepts NULL values
Default value expression (e.g.,
"CURRENT_TIMESTAMP", "nextval('users_id_seq')"))Whether the column is part of the primary key
TableData
Represents paginated table data with column metadata. From/types/database.ts:29-35:
Column metadata
Array of row objects (column name -> value)
Total number of rows in the table
Current page number (1-indexed)
Number of rows per page
SelectedTable
Represents the currently selected table in the UI. From/types/database.ts:37-44:
Server connection ID
Human-readable server name
Database name
Schema name
Table or view name
Object type (
"table", "view", "materialized_view")Schema Definition Types
ColumnDefinition
Extended column definition with full metadata. From/types/schema.ts:12-24:
Column name
PostgreSQL data type
Character length for VARCHAR, CHAR types
Numeric precision (total digits)
Numeric scale (decimal places)
Whether NULL values are allowed
Default value expression
Whether column is part of primary key
Whether column has UNIQUE constraint
Whether column auto-increments (SERIAL, IDENTITY)
Column comment/description
IndexDefinition
Represents a database index. From/types/schema.ts:26-32:
Index name
Array of column names in the index
Whether index enforces uniqueness
Index type:
"btree", "hash", "gin", "gist"Partial index condition (WHERE clause)
ConstraintDefinition
Represents a table constraint. From/types/schema.ts:34-43:
Constraint name
Constraint type:
"primary_key"- Primary key"foreign_key"- Foreign key reference"unique"- Unique constraint"check"- Check constraint
Columns involved in the constraint
Referenced table for foreign keys
Referenced columns for foreign keys
Foreign key ON UPDATE action:
"cascade", "restrict", "set_null", "set_default"Foreign key ON DELETE action:
"cascade", "restrict", "set_null", "set_default"CHECK constraint expression
TableDefinition
Complete table definition with columns, indexes, and constraints. From/types/schema.ts:45-52:
ViewDefinition
View definition with SQL. From/types/schema.ts:54-59:
DatabaseDefinition
Database metadata. From/types/schema.ts:61-68:
SchemaDefinition
Schema metadata. From/types/schema.ts:70-75:
Use Cases
Building a Schema Explorer
Generating CREATE TABLE DDL
Related Types
See also:- Server Connection Types - Connection interfaces
- Query Result Types - Query execution types