[eluser]spescina[/eluser]
Hi guys.
I've read about migrations on the user guide and around on the net. I'm about to start using it but there are some things I cannot understand.
Let's look at a simple scenario.
I've
5 migrations files in my migrations folder (000..004)
-
000_install (10 tables and some rows)
-
001_create_auth_section (2 tables)
-
002_insert_upload_privilege (1 row)
-
003_create_article_section (3 tables)
-
004_insert_download_privilege (1 row)
I've enabled the migrations
config file and I have the
current migration set on 2.
I've the
migration controller with 3 methods: current(), to_version($version) and latest()
In this situation my db should be with 12 tables and with the upload_privilege row.
Now I want to reach migration 4
CI gives me 3 way in order to achieve this
1)
migration->version(4)
2)
migration->latest()
3) set the current config to 4 and run
migration->current()
first question:
when using these methods
a) only migration files 003/004 are going to be processed or
b) all migrations files up the requested version are executed each time?
second question:
if the answer to the previous question is a), using the third method shouldn't be discouraged?
third question:
when going back to a previous version, does CI know how to rollback starting from current version config value?
I think this system is rather "dark".
I think I need an enlightment...