PostgresSchemaInspector
Inspects PostgreSQL database schema and returns a SchemaDefinition.
public static class PostgresSchemaInspector
Methods
Inspect(NpgsqlConnection, string, ILogger?)
public static Result<SchemaDefinition, MigrationError> Inspect(NpgsqlConnection connection, string schemaName = "public", ILogger? logger = null)
Inspect all tables in a PostgreSQL database.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
NpgsqlConnection |
Open PostgreSQL connection |
schemaName |
String |
Schema to inspect (default: public) |
logger |
ILogger |
Optional logger |
Returns: MigrationError> - Schema definition of the database
InspectTable(NpgsqlConnection, string, string, ILogger?)
public static Result<TableDefinition, MigrationError> InspectTable(NpgsqlConnection connection, string schemaName, string tableName, ILogger? logger = null)
Inspect a single table.
Parameters:
| Name | Type | Description |
|---|---|---|
connection |
NpgsqlConnection |
|
schemaName |
String |
|
tableName |
String |
|
logger |
ILogger |
Returns: MigrationError>
PostgresTypeToPortable(string, int?, int?, int?, string?, int?)
public static PortableType PostgresTypeToPortable(string pgType, int? charMaxLen, int? numPrecision, int? numScale, string? udtName = null, int? attTypMod = null)
Convert PostgreSQL type to portable type. Implements [MIG-TYPES-VECTOR] ยง5.4.4: pgvector columns report data_type = "USER-DEFINED" and udt_name = "vector"; the dimension is stored directly in pg_attribute.atttypmod (no VARHDRSZ offset).
Parameters:
| Name | Type | Description |
|---|---|---|
pgType |
String |
|
charMaxLen |
Int32> |
|
numPrecision |
Int32> |
|
numScale |
Int32> |
|
udtName |
String |
|
attTypMod |
Int32> |
Returns: PortableType