From 3e861e589cb487e8e722e5026b09c6d57a369873 Mon Sep 17 00:00:00 2001 From: David Guilherme Date: Tue, 3 Apr 2018 14:32:11 +0100 Subject: [PATCH] chore(pull): fix the idempotency method for table-valued parameters The idempotency method was not scripting out properly when the object type is `TT` when the option is `if-not-exists`. This commit fixes that. fixes #22 --- src/sql/script.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/script.ts b/src/sql/script.ts index 9bbd67d..97cb97c 100644 --- a/src/sql/script.ts +++ b/src/sql/script.ts @@ -73,7 +73,7 @@ export function idempotency(item: AbstractRecordSet, type: IdempotencyOption): s // if not exists if (item.type === 'TT') { return [ - 'if exists (', + 'if not exists (', ' select * from sys.table_types as t', ' join sys.schemas s on t.schema_id = s.schema_id', ` where t.name = '${item.name}' and s.name = '${item.schema}'`,