summaryrefslogtreecommitdiff
path: root/Gestor.Application.Migration.Files.20210302_102.SQL
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application.Migration.Files.20210302_102.SQL')
-rw-r--r--Gestor.Application.Migration.Files.20210302_102.SQL10
1 files changed, 10 insertions, 0 deletions
diff --git a/Gestor.Application.Migration.Files.20210302_102.SQL b/Gestor.Application.Migration.Files.20210302_102.SQL
new file mode 100644
index 0000000..40a967c
--- /dev/null
+++ b/Gestor.Application.Migration.Files.20210302_102.SQL
@@ -0,0 +1,10 @@
+DECLARE @fk_name NVARCHAR(MAX)
+
+SELECT TOP 1 @fk_name = name
+FROM sys.foreign_keys
+WHERE parent_object_id = object_id('adiantamento') AND object_name(referenced_object_id) = 'tipopagto'
+
+DECLARE @sql NVARCHAR(MAX) = N'ALTER TABLE adiantamento DROP CONSTRAINT ' + @fk_name
+
+IF @fk_name IS NOT NULL
+ exec sp_executesql @sql \ No newline at end of file