SQL In MOD / MOD Template

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
Craven-
Registered User
Posts: 19
Joined: Fri Jun 06, 2003 10:51 am

SQL In MOD / MOD Template

Post by Craven- »

Ok I was wondering if this is correct for putting into my MOD Template:


#
#-----[ SQL ]------------------------------------------
#

ALTER TABLE phpbb_users ADD user_posts_frozen TINYINT(1) DEFAULT '0' NOT NULL AFTER user_posts


I wasn't sure about the phpbb_users part.

Also, what is the best way of getting people to 'execute' this SQL, I mean, what if they dont understand SQL, or don't know about phpmyadmin. How do you explain to them how to do it?

Do you create an install file to do the SQL, or is the SQL statement as shown above enough?
User avatar
Smidge204
Registered User
Posts: 23
Joined: Sun Feb 09, 2003 8:50 am

Post by Smidge204 »

A lot of mods I've seen come with an "install.php" file, which they upload and execute to create/modify all the tables as required. phpbb itself even has one.

Just make a php script with all your SQL stuff in it, and say in your readme/install.txt that they need to upload and run it :)

P.S.: If you're modifying the existing phpbb tables, consider using the includes from phpbb - that way, you can do things like:

$sql = "ALTER TABLE " . USERS_TABLE . " ADD user_posts_frozen TINYINT(1) DEFAULT '0' NOT NULL AFTER user_posts";

...since it may not always be called "phpbb_users" (there's a configuration alias for every table phpbb uses!) :wink:
=Smidge=
Craven-
Registered User
Posts: 19
Joined: Fri Jun 06, 2003 10:51 am

Post by Craven- »

Yeah thats why I was wondering and said (above) thats I wasnt shure on the phpbb_users bit, as it could be something different depending on what the user puts.

Perhaps I should make an install file :)
Post Reply

Return to “[2.0.x] MOD Writers Discussion”