Skip to content

Commit 8473d76

Browse files
Delete laboratory.workbooks reference on workbook container delete (#50)
1 parent 2e7328b commit 8473d76

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

laboratory/src/org/labkey/laboratory/LaboratoryContainerListener.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,10 @@ protected void purgeTable(UserSchema userSchema, TableInfo table, Container c)
122122
{
123123
if (table.getName().equalsIgnoreCase(LaboratorySchema.TABLE_WORKBOOKS))
124124
{
125-
if (!c.isWorkbook())
126-
{
127-
SQLFragment sql = new SQLFragment("DELETE FROM laboratory.workbooks WHERE " + LaboratoryWorkbooksTable.PARENT_COL + " = ?", c.getId());
128-
new SqlExecutor(table.getSchema()).execute(sql);
129-
}
125+
SQLFragment sql = new SQLFragment("DELETE FROM laboratory.workbooks WHERE " +
126+
(c.isWorkbook() ? LaboratoryWorkbooksTable.WORKBOOK_COL : LaboratoryWorkbooksTable.PARENT_COL) +
127+
" = ?", c.getId());
128+
new SqlExecutor(table.getSchema()).execute(sql);
130129
}
131130
else
132131
{

0 commit comments

Comments
 (0)