Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: wixi - marraskuu 17, 2013, 01:44:39 IP

Otsikko: Modify Existing Database Table or Create New Table?
Kirjoitti: wixi - marraskuu 17, 2013, 01:44:39 IP
When making mods that change the behaviour of some core part of the forum, wherein changes to database table related to that feature is necessary for the mod, is it better to create a new table rather than modifying the existing one? The database changes may include adding / removing new fields and or modifying the data type or size of existing fields etc.

(This for SMF 2+ on MySQL 5+).
Otsikko: Re: Modify Existing Database Table or Create New Table?
Kirjoitti: Arantor - marraskuu 17, 2013, 01:45:56 IP
Depends what you're doing, really.

More information about what you're doing will help us suggest what is probably best ;) Sometimes it will be better to modify columns, sometimes it won't, but it's hard to say without context.
Otsikko: Re: Modify Existing Database Table or Create New Table?
Kirjoitti: wixi - marraskuu 17, 2013, 02:50:43 IP
Let me rephrase it this way since I can't give details - how do you ensure that your database change doesn't break another mod?
Otsikko: Re: Modify Existing Database Table or Create New Table?
Kirjoitti: Arantor - marraskuu 17, 2013, 03:35:22 IP
Simple answer is that you actually can't. Not even by using separate tables can you be *sure*.

I also fail to see why you can't provide further details.
Otsikko: Re: Modify Existing Database Table or Create New Table?
Kirjoitti: wixi - marraskuu 17, 2013, 04:45:51 IP
I'll play it "safer" and go with a new table.  On the no details part - didn't mean to be an ass, but my client doesn't want me to post ANY details of the mod project online in case someone "steals the idea". Makes my job that much harder ... Appreciate your inputs. Thanks.