the_menace
2008-10-27T15:57:55Z
So I decided to compile and write the script necessary to delete the YAF tables, stored procedures and constraints for the SQL database.
Run each step individually as a precautionary measure and replace [tablename] with yours.
Please use at your own risk.

Quote:


/* YAF DB UNINSTALL SQL SERVER SCRIPT
Use at your own risk! */
--Written by Dennis (menacestudio.com)

--STEP #1
--DROP ALL YAF STORED PROCEDURES

USE [tablename]
GO

declare @procName sysname

declare someCursor cursor FOR
SELECT name FROM sysobjects WHERE type = 'P' AND objectproperty(id, 'IsMSShipped') = 0 and name like 'yaf%'

open someCursor
fetch next FROM someCursor INTO @procName
while @@FETCH_STATUS = 0
begin
exec('drop proc ' + @procName)
fetch next FROM someCursor INTO @procName
end

close someCursor
deallocate someCursor
go


--STEP #2
--DROP ALL YAF CONSTRAINTS
DECLARE @table nvarchar(50)
declare @schema nvarchar(128), @tbl nvarchar(128), @constraint nvarchar(128)
DECLARE @sql nvarchar(255)
declare cur cursor fast_forward for
select distinct cu.constraint_schema, cu.table_name, cu.constraint_name
from information_schema.table_constraints tc
join information_schema.referential_constraints rc on rc.unique_constraint_name = tc.constraint_name
join information_schema.constraint_column_usage cu on cu.constraint_name = rc.constraint_name
where tc.table_name like 'yaf%'
open cur
fetch next from cur into @schema, @tbl, @constraint
while @@fetch_status <> -1
begin
select @sql = 'ALTER TABLE ' + @tbl + ' DROP CONSTRAINT ' + @constraint
exec sp_executesql @sql
fetch next from cur into @schema, @tbl, @constraint
end
close cur
deallocate cur

--STEP #3
--DROP ALL YAF TABLES
USE [tablename]
GO

declare @tableName sysname

declare someCursor cursor FOR
--search through stored procedures
SELECT name FROM sysobjects WHERE name like 'yaf%' and type = 'U'

open someCursor
fetch next FROM someCursor INTO @tableName
while @@FETCH_STATUS = 0
begin
exec('drop table ' + @tableName)
fetch next FROM someCursor INTO @tableName
end

close someCursor
deallocate someCursor
go

Sponsor
toologic
2016-04-18T21:09:09Z
the_menace
Thanks for your script, but after run it I see. that stored functions not deleted! Can you update this script for clear this part?
tha_watcha
2016-04-19T03:59:27Z
You can use the uninstall script from the dnn module

https://github.com/YAFNET/YAFNET-DNN/blob/master/yaf_dnn/Installation/Uninstall.SqlDataProvider 

You only need to replace the variables {databaseOwner}{objectQualifier}
UserPostedImage

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved