开发者

Database migrations in Joomla

Is there any way of using database migrations with Joomla? I'm looking for a mechanism like the one found in Rails or Symfony.

I would like to apply changes to the database whenever my model changes, e.g. adding a column, creating a new relationship, dropping some tables,...

In this question, the accepted answer seems like a very cool option, but I don't know if there is something specific to Joom开发者_运维技巧la.

Thanks!


If you want to update your own component's DB schema you can refer to the following thread: http://forum.joomla.org/viewtopic.php?p=1607199

If you need just migrations without components, check these standalone solutions:

  • https://github.com/davejkiger/mysql-php-migrations
  • https://github.com/Billiam/MySQL-PHP-AutoMigrations


I'm working a lot with Joomla for functionnalities implementations and the model changes are made by sql queries mostly or via phpMyAdmin.

Also we do not changes the model of joomla tables (core or plugins one) because the source code without modifications will not handle the changes. We are only adding tables using external ids (like jos_users id).

Futhermore if you change the model of joomla tables, you will not be able to update it (or the plugins impacted) easily.


there is 2 real ways to do migration in Joomla, and each based really on one solution:

1) Just place you SQL changes(like ceate table, or alter, or any thing) /administrator/components/com_admin/SQL/updates/YOU_DB_ENGINE/anyfilename.sql go to web interface then /administrator => extension => manage => database and simple press fix.

2) you can take a look at /administrator/components/com_installer/models/database.php and implement you custom migration process based on this so you can use custom folder

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜