-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves Mismatch in pathway_event_cohort DDL (#1419)
* WebAPI-975 Extract Cohort Characterization analysis to external package * fixes SQL injection vulnerability * Resolves Mismatch in pathway_event_cohort DDL between sql server and postgresql.
- Loading branch information
Showing
2 changed files
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...qlserver/V2.8.0.20200116134252__remove_obsolete_field_pathway_event_cohort_deleted_id.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- at first removing default value | ||
declare @command nvarchar(1000) | ||
select @command = 'ALTER TABLE ${ohdsiSchema}.pathway_event_cohort DROP CONSTRAINT IF EXISTS ' + d.name | ||
from sys.tables t | ||
join sys.default_constraints d on d.parent_object_id = t.object_id | ||
join sys.columns c on c.object_id = t.object_id and c.column_id = d.parent_column_id | ||
where | ||
t.name = 'pathway_event_cohort' | ||
and t.schema_id = schema_id('${ohdsiSchema}') | ||
and c.name = 'is_deleted'; | ||
execute (@command) | ||
|
||
ALTER TABLE ${ohdsiSchema}.pathway_event_cohort DROP COLUMN IF EXISTS is_deleted; |
@wivern: this should not have been deleted from the migration script. if we want to drop a column later, we should do it in a new migration, not rewrite history.
The issue was raised here: https://forums.ohdsi.org/t/error-deploying-webapi-2-8-0/13031/9, and I believe what happend was that someone did a fresh install (ie, did not upgrade from 2.6) ... and I think we tried to handle this with a 'if exists' statement, but the IF EXISTS syntax does not work until SQL Server 2016 (which not everyone is running on that version).