YAFLogo

Buck
  • Buck
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
Recently my old webhost stopped supporting its accounts and I couldn't get help from them to back up my database before I had to move off the server. So I was forced to export my tables one by one without any of the primary keys, foreign keys or constraints I posted the problem here (Transfer Database data from one db to the other / Redo keys constraints  ) , which you can view for more details.

So I ended up with a copy of all the tables in a database with no keys or constraints and obviously the forum software wouldn't work correctly that way. So to get the Alter scripts for the database keys and constraints I installed a new version of the forum and the scripted the tables out one by one and then used those scripts to alter my original database. I couldn't figure out a way to compare the two databases automatically but it appears that I have everything setup correctly. However when I try do a post on the forum I get this error

Cannot insert the value NULL into column 'EventLogID', table 'yafdb.dbo.yaf_EventLog'; column does not allow nulls. INSERT fails.

The statement has been terminated.

Note: I did install the newest version (2.1.2 BETA 20140406 (Date: 4/5/2014)), which in the beginning I had an issue noted below

ERROR:

Table 'yaf_Board' already has a primary key defined on it.

Could not create constraint. See previous errors.

STATEMENT:

if not exists (select top 1 1 from sys.indexes where object_id=object_id('[dbo].[yaf_Board]') and name='PK_yaf_Board')

alter table [dbo].[yaf_Board] with nocheck add constraint [PK_yaf_Board] primary key clustered (BoardID)

Once I commented out the line that was doing that in the constraints script I was able to get the forum to work outside of not being able to post or I suspect anything that uses the EvenLog. Does anybody have a suggestion of how I can fix this or possibly move my content from one database to another if a fix is going to be impossible?

Edit I went into the host settings and removed the checks to save anything to the logs to see if I could get by the above error and was presented with this error:

Cannot insert the value NULL into column 'TopicID', table 'yafdb.dbo.yaf_Topic'; column does not allow nulls. INSERT fails.

Cannot insert the value NULL into column 'TopicID', table 'yafdb.dbo.yaf_Message'; column does not allow nulls. INSERT fails.

The statement has been terminated.

The statement has been terminated.

I am confused to why I am getting a null insert error since the db seems to have all the keys and constraints there and the forum is the original forum that ran with the database (well sort of since I did upgrade it to the new beta version).

Sponsor
Buck
  • Buck
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
OK I just used Redgate's SQL Compare to check for differences in the tables and found quite a few. I have updated the differences and it seems that I can post now. I am going to try and do some more things in the morning just to be sure but I think I have this issue resolved now.