Database migrations in Joomla

2019-07-05 05:32发布

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 Joomla.

Thanks!

3条回答
Emotional °昔
2楼-- · 2019-07-05 06:10

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:

查看更多
再贱就再见
3楼-- · 2019-07-05 06:17

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.

查看更多
疯言疯语
4楼-- · 2019-07-05 06:27

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

查看更多
登录 后发表回答