0

I have a fully completed existing codeigniter project with me. I created a mysql db locally and changed dbnames in database.php.

Now, how to setup this db by creating tables etc as per the code.

I thought db/tables would be automatically created but when I opened page it said 'ci_sessions' table is not created.

For eg: in ruby on rails, once we have code, we can do

rake db:migrate

which will create all tables. I want this feature.

In Django, we can do

 python manage.py syncdb

which will create all tables.

In java, I will have an sql file, I will execute that file using db commands which will generate db table.

Anything like any of the above in codeigniter ?

3 Answers 3

1

if the CI project is fully completed, you can export your database and import it on the server you will be using... about creating database or table thru php code you can check CI DB Forge Documentation or check this one

Sign up to request clarification or add additional context in comments.

1 Comment

I dont have access to the db. I think the links you gave are useful during development of code. Since we have code, cant I execute single command that creates the db skeleton? For eg: in ruby on rails, once we have code, we can do rake db:migrate which will create all tables. I want this feature.
0

in config.php file you need to change sess_use_database false or create table name ci_session

$config['sess_use_database']    = FALSE;
$config['sess_table_name']      = 'ci_session';

1 Comment

Hi, thats working, but please tell me if I am correct - the only way to create db/tables is to generate .sql file from the old db or directly dump from old db. No other way, right ?(like syncdb in python/Django).
0

That depends. When I was using Doctrine (an ORM layer for PHP/MySQL) with CodeIgniter I had to use a call on the URL to generate DB models. It generated models maps to all the tables in the database.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.