• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add dummy content when running migrations

#4
(10-05-2015, 07:30 AM)Lykos22 Wrote:
(10-05-2015, 07:09 AM)orionstar Wrote: You can access the $this->db object so you can insert anything what you want with $this->db->insert() or $this->db->update(). Wink

About the timestamp: you have to find out a timestamp what follows the format (YYYYMMDDHHIISS -> 20121031100537) and append the name of the migration. But you should read the docs if you're not lazy... See http://www.codeigniter.com/user_guide/li...ation.html

Thank you for your reply. About the timestamps, I'm afraid you didn't understood me.. The documentation says:


Quote:Each Migration is run in numeric order forward or backwards depending on the method taken.

If I set the migration type to Timestamp, do I have to run


Code:
$this->migration->version(5);

with the timestamp or just the number of the migration ? Also if I have set timestamps to migrations, do I have to generate somehow a timestamp in order to apply in to the name of the file etc? do something like this for instance


PHP Code:
echo date('YmdHis'); 

If you are using sequential based migrations then you specify a number, if you use timestamp based migrations you have to use the full timestamp.

Quote:Then in application/config/migration.php set $config['migration_version'] = 20121031100537;.

You can auto generate the timestamp or you can create it manually, for example I have a CLI tool for autogenerating migrations with properly formatted filename, CI not support this from out of box.
Reply


Messages In This Thread
RE: Add dummy content when running migrations - by orionstar - 10-05-2015, 07:59 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.