Welcome Guest, Not a member yet? Register   Sign In
Recover a database from a CI script?
#1

[eluser]John D[/eluser]
Hey,

I have a script developed using CI but I don't have the actual backup of the database after the site was lost - Is there any way at all to create a database (Just the tables etc.) using files from CI?

Thanks!
#2

[eluser]davidbehler[/eluser]
Automatically? No.

You'd have to go through all models and look at what tables and what fields they use and re-create the database manually based on what you find.
#3

[eluser]John D[/eluser]
I wouldn't mind doing that Smile

As long as I could get the database tables back.
Is there a standard structure for how tables are created or are they going by the developer?

I didn't know CI was used by the developer until I got the backup and started looking at it.

Thanks for the reply Smile
#4

[eluser]davidbehler[/eluser]
It's good practice to only use models (all files in /application/models) to access the database. So that's hopefully where you'll find all the info you need.

The thing is, that the table definition propably isn't in there...just multiple function that access the tables in one way or another. So you'll have to check every function, see what tables and fields it uses and re-create them based on that.
#5

[eluser]John D[/eluser]
Quick reply, thanks Smile

I had a look in the folder but I only have an index with code for forbidden..

I have to add this is from CI on Dec 2007 from the modified dates for the files so there could be a huge amount changed since then.

I have no idea what version of CI it is using, is there a way to check?
Maybe using an older version could be a better more simplistic way to find tables...maybe worse..
#6

[eluser]davidbehler[/eluser]
Check CodeIgniter.php in the systems folder (might be in a sub-folder, not sure). There should be a constant or some comment with the version. I'm guessing 1.5 Smile

If there are no files in the models folder, then you should check the libraries and controllers. If the app uses tables, then it's gotta be in one of these files Wink
#7

[eluser]John D[/eluser]
Very basic question but I just found CI today, how do developers setup databases / tables while coding using it?
Is it all manually through phpmyadmin or something similar?
its to know if i need to know how to setup each table if its not saved anywhere, I haven't talked to the coder in a long time so Im not sure on how he had it setup.

Thanks again!
#8

[eluser]davidbehler[/eluser]
Just manually set them up in phpmyadmin. CI provides no way of managing your tables/databases.
#9

[eluser]John D[/eluser]
1.5.4 Smile




Theme © iAndrew 2016 - Forum software by © MyBB