Page MenuHomePhabricator

Document that extensions shouldn't change MW core db tables
Open, Needs TriagePublic

Description

Ugh... Why does this extension modify a core table? That's a real big faux pas :(
https://www.mediawiki.org/wiki/Do_not_hack_MediaWiki_core
It should add it's own DB table, with a PK/FK of the user_id, and then the two columns it needs

I agree with you. But the linked page doesn't actually say anything about database changes at all, and I also couldn't find any advice about this on other pages like:
https://www.mediawiki.org/wiki/Manual:Hooks/LoadExtensionSchemaUpdates
https://www.mediawiki.org/wiki/Manual:Developing_extensions
https://www.mediawiki.org/wiki/Manual:Database_access
https://www.mediawiki.org/wiki/Development_policy
https://www.mediawiki.org/wiki/Best_practices_for_extensions#Database
I would suggest that the documentation should be updated to reflect this policy.

For example...

https://www.mediawiki.org/wiki/Best_practices_for_extensions#Database should have an entry that extensions shouldn't modify core database tables. REQUIRED?

Event Timeline

Reedy created this task.Jan 21 2018, 7:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 21 2018, 7:08 PM
This comment was removed by Eisheeta.

Hello, I've made required changes here: https://www.mediawiki.org/wiki/Best_practices_for_extensions#Database.

I'm not sure if it's enough or do I need to make changes elsewhere as well?
Do let me know!
Thank you!

Reedy renamed this task from Document that extensions shouldn't change MW core db talbes to Document that extensions shouldn't change MW core db tables.Mar 21 2019, 8:48 PM
Reedy added a comment.Mar 21 2019, 9:32 PM

Hello, I've made required changes here: https://www.mediawiki.org/wiki/Best_practices_for_extensions#Database.
I'm not sure if it's enough or do I need to make changes elsewhere as well?
Do let me know!
Thank you!

I note there's a few usages of "SHALL NOT" on this page, but that's not a defined term (out of the scope of this task though).

I did word the task to say "should", I wonder if "RECOMMENDED" is more appropriate for that page

(wording and english is hard!)

Per the original description..

https://www.mediawiki.org/wiki/Manual:Developing_extensions#Adding_database_tables - Should mention here that extensions should not modify core tables, but add their own, with a FK to the relevant MW table

Either in https://www.mediawiki.org/wiki/Manual:Hooks/LoadExtensionSchemaUpdates#Usage or https://www.mediawiki.org/wiki/Manual:Hooks/LoadExtensionSchemaUpdates#Summary I think it's a good place to reiterate the above too, because this is likely where developers new to MW might be looking to know how to make database changes, so having it highlighted would be a good idea (that page maybe needs some of the older methods removing too)

How is your sql? I wonder if we could add a really simple example too

I don't think, offhand at least, the other pages necessarily need this information

@Reedy Thank you so much for your feedback. :) I think should should suffice at this point if we're not sure of the impact of the extension modifying the core table. Also, I'll update the pages you've mentioned as well!

I do know basic sql, but it'd be great if you could let me know what kind of an example and where should we include it?