Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,13 @@ public override Task FindTestWithQueryStringOnViews()
throw new NotImplementedException();
}

[TestMethod]
[Ignore]
public override Task FindTestWithInvalidFieldsInQueryStringOnViews()
{
throw new NotImplementedException();
}

public override string GetDefaultSchema()
{
return DEFAULT_SCHEMA;
Expand Down
16 changes: 0 additions & 16 deletions DataGateway.Service/PostgreSqlBooks.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
DROP VIEW IF EXISTS books_view_all;
DROP VIEW IF EXISTS stocks_view_selected;
DROP VIEW IF EXISTS books_publishers_view_composite;
DROP TABLE IF EXISTS book_author_link;
DROP TABLE IF EXISTS reviews;
DROP TABLE IF EXISTS authors;
Expand Down Expand Up @@ -157,16 +154,3 @@ SELECT setval('book_website_placements_id_seq', 5000);
SELECT setval('publishers_id_seq', 5000);
SELECT setval('authors_id_seq', 5000);
SELECT setval('reviews_id_seq', 5000);

DO $do$
BEGIN
EXECUTE('CREATE VIEW books_view_all AS SELECT * FROM books');
EXECUTE('CREATE VIEW stocks_view_selected AS SELECT
categoryid,pieceid,"categoryName","piecesAvailable"
FROM stocks');
EXECUTE('CREATE VIEW books_publishers_view_composite as SELECT
publishers.name,books.id,books.publisher_id
FROM books,publishers
where publishers.id = books.publisher_id');
END
$do$;
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,15 @@ private async Task PopulateTableDefinitionAsync(
DataTable dataTable = await GetTableWithSchemaFromDataSetAsync(schemaName, tableName);

List<DataColumn> primaryKeys = new(dataTable.PrimaryKey);

if (primaryKeys.Count == 0)
{
throw new DataGatewayException(
message: $"Primary key not configured on the given database object {tableName}",
statusCode: System.Net.HttpStatusCode.NotImplemented,
subStatusCode: DataGatewayException.SubStatusCodes.ErrorInInitialization);
}

tableDefinition.PrimaryKey = new(primaryKeys.Select(primaryKey => primaryKey.ColumnName));

using DataTableReader reader = new(dataTable);
Expand Down
51 changes: 0 additions & 51 deletions DataGateway.Service/hawaii-config.PostgreSql.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,57 +207,6 @@
"source": "website_users",
"rest": false,
"permissions": []
},
"books_view_all": {
"source": "books_view_all",
"rest": true,
"graphql": true,
"permissions": [
{
"role": "anonymous",
"actions": [ "read" ]
},
{
"role": "authenticated",
"actions": [ "read" ]
}
],
"relationships": {
}
},
"stocks_view_selected": {
"source": "stocks_view_selected",
"rest": true,
"graphql": true,
"permissions": [
{
"role": "anonymous",
"actions": [ "read" ]
},
{
"role": "authenticated",
"actions": [ "read" ]
}
],
"relationships": {
}
},
"books_publishers_view_composite": {
"source": "books_publishers_view_composite",
"rest": true,
"graphql": true,
"permissions": [
{
"role": "anonymous",
"actions": [ "read" ]
},
{
"role": "authenticated",
"actions": [ "read" ]
}
],
"relationships": {
}
}
}
}