Drop All Action Form Tables
Use this to completely remove Action Form Tables
-- DROP FOREIGN KEYS
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_avtActionForm_FormFields_Modules]') AND OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[avtActionForm_FormFields] DROP CONSTRAINT [FK_avtActionForm_FormFields_Modules]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_ActionForm_Reports_Modules]') AND OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[avtActionForm_Reports] DROP CONSTRAINT [FK_ActionForm_Reports_Modules]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_avtActionForm_FormSettings_Modules]') AND OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[avtActionForm_FormSettings] DROP CONSTRAINT [FK_avtActionForm_FormSettings_Modules]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_avtActionForm_FormActions_Modules]') AND OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[avtActionForm_FormActions] DROP CONSTRAINT [FK_avtActionForm_FormActions_Modules]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_avtActionForm_FormActions_Users]') AND OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[avtActionForm_FormActions] DROP CONSTRAINT [FK_avtActionForm_FormActions_Users]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[FK_avtActionForm_ReportFields_avtActionForm_Reports]') AND OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[avtActionForm_ReportFields] DROP CONSTRAINT [FK_avtActionForm_ReportFields_avtActionForm_Reports]
GO
-- DROP STORED PROCEDURES AND FUNCTIONS
IF object_id(N'[dbo].[avtActionForm_SplitString]', N'TF') IS NOT NULL
DROP FUNCTION [dbo].[avtActionForm_SplitString]
GO
-- DROP TABLES
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[avtActionForm_FormFields]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE [dbo].[avtActionForm_FormFields]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[avtActionForm_Reports]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE [dbo].[avtActionForm_Reports]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[avtActionForm_Activations]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE [dbo].[avtActionForm_Activations]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[avtActionForm_FormSettings]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE [dbo].[avtActionForm_FormSettings]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[avtActionForm_FormActions]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE [dbo].[avtActionForm_FormActions]
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[avtActionForm_ReportFields]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE [dbo].[avtActionForm_ReportFields]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF [dbo].[DnnSharp_IsAnyModuleInstalled]() = 0
BEGIN
IF OBJECT_ID('[dbo].DnnSharp_PersistentCache', 'U') IS NOT NULL
DROP TABLE [dbo].[DnnSharp_PersistentCache]
-- Drop Scheduled Tasks
IF EXISTS
(SELECT *
FROM [dbo].[Schedule]
WHERE REPLACE(TypeFullName, ' ', '') LIKE 'DnnSharp.Common.InitCommonDlls.RemovePersistentCacheScheduler,DnnSharp.Common.InitCommonDlls%')
DELETE FROM [dbo].[Schedule]
WHERE REPLACE(TypeFullName, ' ', '') LIKE 'DnnSharp.Common.InitCommonDlls.RemovePersistentCacheScheduler,DnnSharp.Common.InitCommonDlls%'
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[NtextTOnVARCHAR]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[NtextTOnVARCHAR]
-------------
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DnnSharp_CredentialStoreGroup_Portals]') AND parent_object_id = OBJECT_ID(N'[dbo].[DnnSharp_CredentialStoreGroup]'))
ALTER TABLE [dbo].[DnnSharp_CredentialStoreGroup] DROP CONSTRAINT [FK_DnnSharp_CredentialStoreGroup_Portals]
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DnnSharp_CredentialStoreGroup_DnnSharp_CredentialStoreType]') AND parent_object_id = OBJECT_ID(N'[dbo].[DnnSharp_CredentialStoreGroup]'))
ALTER TABLE [dbo].[DnnSharp_CredentialStoreGroup] DROP CONSTRAINT [FK_DnnSharp_CredentialStoreGroup_DnnSharp_CredentialStoreType]
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DnnSharp_CredentialStoreData_DnnSharp_CredentialStore]') AND parent_object_id = OBJECT_ID(N'[dbo].[DnnSharp_CredentialStoreData]'))
ALTER TABLE [dbo].[DnnSharp_CredentialStoreData] DROP CONSTRAINT [FK_DnnSharp_CredentialStoreData_DnnSharp_CredentialStore]
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_DnnSharp_CredentialStore_DnnSharp_CredentialStoreGroup]') AND parent_object_id = OBJECT_ID(N'[dbo].[DnnSharp_CredentialStore]'))
ALTER TABLE [dbo].[DnnSharp_CredentialStore] DROP CONSTRAINT [FK_DnnSharp_CredentialStore_DnnSharp_CredentialStoreGroup]
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DnnSharp_CredentialStoreType]') AND type in (N'U'))
DROP TABLE [dbo].[DnnSharp_CredentialStoreType]
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DnnSharp_CredentialStoreGroup]') AND type in (N'U'))
DROP TABLE [dbo].[DnnSharp_CredentialStoreGroup]
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DnnSharp_CredentialStoreData]') AND type in (N'U'))
DROP TABLE [dbo].[DnnSharp_CredentialStoreData]
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DnnSharp_CredentialStore]') AND type in (N'U'))
DROP TABLE [dbo].[DnnSharp_CredentialStore]
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DnnSharp_Actions]') AND type in (N'U'))
DROP TABLE [dbo].[DnnSharp_Actions]
--- DO NOT WRITE ANYTHING BELOW THIS LINE. ONLY THE DnnSharp_IsAnyModuleInstalled FUNCTION DELETION.
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[DnnSharp_IsAnyModuleInstalled]') AND OBJECTPROPERTY(id, N'IsScalarFunction') = 1)
DROP FUNCTION [dbo].[DnnSharp_IsAnyModuleInstalled]
END