Michael Richardson
Michael Richardson

Reputation: 293

CodeIgniter: How can I populate a new database with cloned website source files?

I have been sent a copy of the files of a Code Igniter website. It is the files on the live website simply zipped up and sent over.

I have cloned it on my machine and connected it to an empty MySQL database. I am used to being able to run some code that will then populate the database with the correct tables. I can't work out how to do this with this site.

I have looked at the migration section of the CodeIgniter documentation and searched for solutions on this topic on Google and Stack Overflow.

The error I get is:

A Database Error Occurred
Error Number: 1146

Table 'test.users' doesn't exist

SELECT * FROM (`users`) WHERE `deleted` != 1

Filename: /Applications/MAMP/htdocs/testserver/models/user_model.php

Line Number: 242

Would I need a copy of the current database from the live site? Is there a way I can run a script to create the database tables?

I have never used CodeIgniter. So far I have seen I need to do this in migration.php.

$config['migration_enabled'] = TRUE;

Upvotes: 0

Views: 261

Answers (1)

Stromgren
Stromgren

Reputation: 1074

Yes, what the error message basically tells you is that you need a database called 'test' with a table called 'users' (test.users)

You should check if any migrations has been written in /application/migrations you should be able to run them by pointing your browser at example.com/index.php/migrate. Given that you've setup your database config.

Upvotes: 1

Related Questions