YAFLogo

Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer Topic Starter
2010-06-17T08:29:22Z
When trying to create a new forum, the db returns the following error:

The INSERT statement conflicted with the FOREIGN KEY SAME TABLE constraint "FK_yaf_Forum_yaf_Forum". The conflict occurred in database "yafnet", table "dbo.yaf_Forum", column 'ForumID'.
Cannot insert the value NULL into column 'ForumID', table 'yafnet.dbo.yaf_ForumAccess'; column does not allow nulls. INSERT fails.
The statement has been terminated.
The statement has been terminated.
That's because the @ParentID is set to 0 which conflicts with the foreign key defined in yaf_forum.

Adding

if @ParentID = 0 set @ParentID = null
to the yaf_forum_save stored procedure solves the issue.
If at first you don’t succeed, call it version 1.0
Sponsor
Kamyar
  • Kamyar
  • 100% (Exalted)
  • YAF Developer Topic Starter
2010-06-17T09:56:25Z
Just committed to SVN No. 3433

Hopefully, it works fine now.


If at first you don’t succeed, call it version 1.0