aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2021-03-07 11:59:51 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2021-03-07 11:59:51 +0200
commit6bf859daa6e468d0414e2dceb781ba408f7012de (patch)
tree814c5561414d7ef6d9bcf77daf09a419dc5a9790 /Software/Visual_Studio
parent8f8ac059563291683cb3a36d88db09bc9bdbe399 (diff)
downloadTango-6bf859daa6e468d0414e2dceb781ba408f7012de.tar.gz
Tango-6bf859daa6e468d0414e2dceb781ba408f7012de.zip
Drop all tables notes.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Notes/Tango.Notes/DB/Drop All Tables.sql19
-rw-r--r--Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj3
2 files changed, 21 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Notes/Tango.Notes/DB/Drop All Tables.sql b/Software/Visual_Studio/Notes/Tango.Notes/DB/Drop All Tables.sql
new file mode 100644
index 000000000..c7d7cfdfe
--- /dev/null
+++ b/Software/Visual_Studio/Notes/Tango.Notes/DB/Drop All Tables.sql
@@ -0,0 +1,19 @@
+DECLARE @sql NVARCHAR(2000)
+
+WHILE(EXISTS(SELECT 1 from INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE='FOREIGN KEY'))
+BEGIN
+ SELECT TOP 1 @sql=('ALTER TABLE ' + TABLE_SCHEMA + '.[' + TABLE_NAME + '] DROP CONSTRAINT [' + CONSTRAINT_NAME + ']')
+ FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
+ WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
+ EXEC(@sql)
+ PRINT @sql
+END
+
+WHILE(EXISTS(SELECT * from INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME != '__MigrationHistory' AND TABLE_NAME != 'database_firewall_rules'))
+BEGIN
+ SELECT TOP 1 @sql=('DROP TABLE ' + TABLE_SCHEMA + '.[' + TABLE_NAME + ']')
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_NAME != '__MigrationHistory' AND TABLE_NAME != 'database_firewall_rules'
+ EXEC(@sql)
+ PRINT @sql
+END \ No newline at end of file
diff --git a/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj b/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj
index b26562a12..6491cfa8e 100644
--- a/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj
+++ b/Software/Visual_Studio/Notes/Tango.Notes/Tango.Notes.csproj
@@ -49,6 +49,7 @@
<Content Include="Azure\Test User Credentials.txt" />
<Content Include="Azure\SQL Database.txt" />
<Content Include="DB\DB Schema Change Log.txt" />
+ <Content Include="DB\Drop All Tables.sql" />
<Content Include="DB\Fix Job Corrupted Runs Start Time.sql" />
<Content Include="DB\SQL Dependency.txt" />
<Content Include="EDrawMax\License.txt" />
@@ -68,7 +69,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file