Skip to content

Commit

Permalink
Get Postgres views
Browse files Browse the repository at this point in the history
fixes #233
  • Loading branch information
Erik Ejlskov Jensen committed Oct 4, 2019
1 parent b1c688a commit f67ab72
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/GUI/EFCorePowerTools/Helpers/EnvDTEHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,19 @@ internal static List<TableInformationModel> GetNpgsqlTableNames(string connectio
using (var npgsqlConn = new NpgsqlConnection(connectionString))
{
npgsqlConn.Open();

var tablesDataTable = npgsqlConn.GetSchema("Tables");
foreach (DataRow row in tablesDataTable.Rows)
{
var schema = row["table_schema"].ToString();
if (schema != "pg_catalog"
&& schema != "information_schema")
{
// TODO: Check if the table has a primary key
result.Add(new TableInformationModel(schema + "." + row["table_name"].ToString(), true));
}
// TODO: Check if the table has a primary key
result.Add(new TableInformationModel(row["table_schema"].ToString() + "." + row["table_name"].ToString(), true));
}

var viewsDataTable = npgsqlConn.GetSchema("Views");
foreach (DataRow row in viewsDataTable.Rows)
{
// TODO: Check if the table has a primary key
result.Add(new TableInformationModel(row["table_schema"].ToString() + "." + row["table_name"].ToString(), true));
}
}

Expand Down

0 comments on commit f67ab72

Please sign in to comment.