YAFLogo

Buck
  • Buck
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
11 years ago
I had to transfer from one host to another recently and the old host would not allow me (or help me) backup my database so that I could move it to the new host so all I could do is script all the content to the database on the new host which now as all the data but none of the keys or constraints. So now, on the new host, I have an exact copy of the tables, views, functions, stored procedures but none of the keys and constraints that would make YAF forum work as it should.

I also have a brand new database set up on the new host with everything correct but none of the data from my old forum so not I would like to either bring the old data to the new server or apply all the constraints and keys to old database, which ever is better (easier). I tried to import all the database from the old DB to the new DB but I received an error saying that I couldn't insert keys from one to the other , which in hindsight does make sense.

So right now I am stuck on how to move ahead. Can somebody offer some advice or a hint on how to merge my database with my data?

Sponsor
Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader YAF Version: YAF 3.1.16
11 years ago
Do you have any access to the old database from the old host?

If you have created a new YAF database with NO data, I would believe you can import the data table by table. I did something similar when I ported my php website forum to YAF a couple years ago.

There is a "Task" context menu option that you can use to import the data from old to new. So this would be easy. However, I am not sure how the identity field (ID) would work. I don't know if you can insert that value or if YAF forces it to be auto numerated.

Alternatively, lets say you have 1,200 users, but the last userid is 1,490.

Create 1,490 dummy records.

Run an update for oldUserID = newUserID to update the fields appropriately.

This would have to be repeated for each table. Actually, it'd be an interesting and fun little project.

... That's what I'd do. Figure out which table has to be created first. Import the data. If it fails because of the identity field, I'd toss in X amount of dummy records and then execute some SQL update for each userid I have. And repeat the process for each table.

Buck
  • Buck
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
11 years ago
I don't have access to the original database but I do have all the data in a database on my server. I basically have two databases set up.

1. yaf1 with all the data but none of the referential integrity setup

2. yaf2 with the referential integrity but none of the data.

I tried to do an import from one db to the other but I received a constraint violation warning, which I think was because it was trying to import the original keys. I then thought I could just skip that column but i was a little worried that things would get screwed up with foreign keys not matching up right if I tried that.

I hadn't thought about the update method that you talked about but I may try that if there is not a way to just script out the keys and constraints.

Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader YAF Version: YAF 3.1.16
11 years ago
Hopefully the keys can be scripted for you. I am not that experienced with them so I can't speak on that intelligently. I'd just write a tool for inserting dummy records, then update with the corresponding ID table by table. I'm not saying that's the way to go, or the best way. It's just what I know would work.

Good luck!