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?)
public static PortableType PostgresTypeToPortable(string pgType, int? charMaxLen, int? numPrecision, int? numScale)
Convert PostgreSQL type to portable type.
Parameters:
| Name | Type | Description |
|---|---|---|
pgType |
String |
|
charMaxLen |
Int32> |
|
numPrecision |
Int32> |
|
numScale |
Int32> |
Returns: PortableType