/// <summary> /// /// </summary> /// <returns></returns> public override List <TableInfo> GetTableInfos() { PostgresTableManager.InitializeTables(); PostgresColumnManager.InitializeColumns(); PostgresPrimaryKeyManager.InitializePrimaryKeys(); PostgresForeignKeyManager.InitializeForeignKeys(); PostgresUniqueKeyManager.InitializeUniqueKeys(); var postgresTables = PostgresTableManager.GetTables(); _tableInfos = postgresTables.Select(ConvertToTableInfo).ToList(); _tableInfos.ForEach(FillForeignKeyInfos); return(_tableInfos); }
/// <summary> /// /// </summary> /// <param name="table"></param> /// <param name="postgresTable"></param> /// <returns></returns> private PrimaryKeyInfo GetPrimaryKeyInfo(TableInfo table, PostgresTable postgresTable) { var sqlPrimaryKey = PostgresPrimaryKeyManager.GetPrimaryKey(postgresTable); if (sqlPrimaryKey == null) { return(null); } var primaryKey = new PrimaryKeyInfo(); primaryKey.Name = sqlPrimaryKey.ConstraintName; primaryKey.Table = table; primaryKey.PrimaryColumn = table.GetColumn(sqlPrimaryKey.ColumnName); return(primaryKey); }