Closed nowinski closed 3 years ago
Error when attempting to remove datastore column after a project dataset has been created. DatastoreController.cs RemoveMasterField method attempts to delete Field record before deleting related DatasetField records.
The DELETE statement conflicted with the REFERENCE constraint "FK_dbo.DatasetFields_dbo.Fields_FieldId"
Proposed fix:
Error when attempting to create a column named "Comments" in dataset builder.
Main dataset view already has a column with that name (ActivitiesQA table Comments). Traced to DatabaseTableHelper.cs line 84.
Column is created on the table and record created in Fields table and appears on the Admin Datastore fields screen. After manually deleting table column db (header table), received error message when attempting to delete row from Datastore fields grid:
Okay--normally, users won't be manually dropping columns from tables but still propose changing DatabaseColumnHelper.cs line 30 from
var query = "ALTER TABLE " + tableName + " DROP COLUMN " + in_field.DbColumnName;
to
var query = "ALTER TABLE " + tableName + " DROP COLUMN IF EXISTS " + in_field.DbColumnName;