Skip to content
This repository has been archived by the owner on Aug 5, 2018. It is now read-only.

Database update function #13

Open
micha-09 opened this issue Feb 6, 2014 · 7 comments
Open

Database update function #13

micha-09 opened this issue Feb 6, 2014 · 7 comments
Assignees

Comments

@micha-09
Copy link
Contributor

micha-09 commented Feb 6, 2014

For Plugin updates the database needs method to compare two database.xml files.
If col exists in the first, but not in the second, remove the col.
If col exitsts in the first and in the second do nothing
If col doesnt exists in the first but in the secon add this col
I think thats are all cases.

@ebroda
Copy link
Contributor

ebroda commented Feb 7, 2014

Not just cols but also complete tables. The same three cases. It might happen that another table is added or one of the existing is deleted.

We should take an backup of the data (see #12) before the update so data which might be no longer served is not lost.

@micha-09
Copy link
Contributor Author

micha-09 commented Feb 7, 2014

No because, if the developer add or remove or edit cols in a table this the conflict case. New tables in a plugin are easy to handle. They will be added. And tables that no more in update will be delete

@ebroda
Copy link
Contributor

ebroda commented Feb 7, 2014

I didn't get your "no because". Your issue is named "Database update function", so new and removed complete tables are part of this function. And in your issue description is nothing said about tables.

@micha-09
Copy link
Contributor Author

micha-09 commented Feb 7, 2014

ok i think i implement it by myself...
The update function is need to update tables, because tables are parts of database i call the issue like this.
Plugins deliver tables, you know? So my post are current.

@ebroda
Copy link
Contributor

ebroda commented Feb 7, 2014

So have fun by implement it and take the issue for yourself...

I just wanted to say what I think is missing in your issue description. It was just an addition to what you wanted to do so far. The name of the issue is right. This is what the function should do. But in your description (1. comment) you're just talking about columns in a table. You're not saying anything about tables. It could be possible that i add a another table in the next release of my plugin and you have to check this also.
Of course I know that plugins deliver tables. I just used them :-) But what happens if a complete table is removed or added. You didn't notice that if you just take a look at the columns. If a new table is added and you wanna add cols to it but the table doesn't exist so far, you get a problem.

So first of all you should compare the tables that exists for far and the tables the plugin want to have now. To have an exampe:
Before: board, board_moderator
After: board, board_reports
So you have to remove board_moderator and have to add board_reports, right?

And after this step you could take a look at the tables (in this case board) that already existed and now might be changed what was your first idea in this issue.

@hajo-p
Copy link
Member

hajo-p commented Feb 7, 2014

the issue name should be database migrations or something alike. while many migrations could be automated there will be cases when that is not possible or takes a huge effort. so there should be a possibility to ship migration files for updates between versions of a plugin, e.g. in plain SQL that works for all four database drivers.

this issue will include a lot of work and will need a lot of stuff, so we should decide carefully how and what will be included, e.g. at our next team meeting.

@micha-09
Copy link
Contributor Author

micha-09 commented Feb 7, 2014

yes but without this, no plugin updates are available!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants