Adding sql database inserts to phpbb3.0 Install Script

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
User avatar
bbrian017
Member
Member
Posts: 64
Joined: 12 Apr 2007, 21:36

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby bbrian017 » 20 Jun 2007, 17:59

Ganon_Master wrote:Hmm...I smell a points system being added to the premod! :P

Database inserts go into install/database_update.php. Find the line below, and you'll see where your first SQL line needs to go.

Code: Select all

// add the various statements    Â      


The second line, is altering the table. Shouldn't be necessary, since you're installing phpBB for the first time. So you can jsut add it to the table creation. The SQL files are in the install\schemas folder. For instance, you have the mysql_40_schema.sql.

Code: Select all

#
#-----[ FIND ]------------------------------------------
#

# Table: 'phpbb_users'

#
#-----[ FIND ]------------------------------------------
#

user_newpasswd varbinary(96) DEFAULT '' NOT NULL,

#
#-----[ AFTER, ADD ]------------------------------------------
#

user_points int(11) DEFAULT '0' NOT NULL



eviL <3 do I still need to do this part as well?

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby igorw » 20 Jun 2007, 18:23

Yes, that's another SQL command...

User avatar
bbrian017
Member
Member
Posts: 64
Joined: 12 Apr 2007, 21:36

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby bbrian017 » 20 Jun 2007, 18:25

Alright I continue to get this error and this is how i have the files edited now :)

mysql_40_schema.sql

Code: Select all

user_newpasswd varbinary(96) DEFAULT '' NOT NULL,
 user_points int(11) DEFAULT '0' NOT NULL,   PRIMARY KEY (user_id),
   KEY user_birthday (user_birthday),


and i also have this Schema data.sql

Code: Select all

;INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');# MOD: SIMPLE POINTS SYSTEM
INSERT INTO phpbb_acl_options( auth_option, is_global, is_local ) VALUES ('f_points', 0, 1);# POSTGRES COMMIT #



Code: Select all

A fatal and unrecoverable database error has occurred. This may be because the specified user does not have appropriate permissions to CREATE TABLES or INSERT data, etc. Further information may be given below. Please contact your hosting provider in the first instance or the support forums of phpBB for further assistance.

install_install.php [ 1214 ]

SQL : INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');# MOD: SIMPLE POINTS SYSTEM INSERT INTO phpbb_acl_options( auth_option, is_global, is_local ) VALUES ('f_points', 0, 1);# POSTGRES COMMIT #

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';# MOD: SIMPLE POINTS SYSTEM INSERT INTO phpbb_acl_options( auth_option, is_glob' at line 1



I really appreciate this help guys :)

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby igorw » 20 Jun 2007, 19:25

Code: Select all

    INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');# MOD: SIMPLE POINTS SYSTEM
    INSERT INTO phpbb_acl_options( auth_option, is_global, is_local ) VALUES ('f_points', 0, 1);# POSTGRES COMMIT #

Should be:

Code: Select all

    INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
# MOD: SIMPLE POINTS SYSTEM
    INSERT INTO phpbb_acl_options( auth_option, is_global, is_local ) VALUES ('f_points', 0, 1);

User avatar
bbrian017
Member
Member
Posts: 64
Joined: 12 Apr 2007, 21:36

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby bbrian017 » 20 Jun 2007, 21:12

Code: Select all

General Error
SQL ERROR [ mysql4 ]

Unknown column 'user_points' in 'field list' [1054]

SQL

UPDATE phpbb_users SET user_points = user_points + 1 WHERE user_id = 2

BACKTRACE


FILE: includes/db/mysql.php
LINE: 133
CALL: dbal_mysql->sql_error()

FILE: includes/mods/functions_points.php
LINE: 27
CALL: dbal_mysql->sql_query()

FILE: posting.php
LINE: 968
CALL: add_points()


This hapens when I try and post ? I'm assuming this is because one the the sql actions didn't go through. You will be happy to know that the error is gone during the install which is a good thing. Any suggestions on why this is happening

User avatar
Ganon_Master
Past Contributor
Past Contributor
Posts: 311
Joined: 20 Nov 2006, 16:23
Real name: Hidde
Location: Soesterberg, Utrecht, The Netherlands

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby Ganon_Master » 21 Jun 2007, 19:52

You have to add this line to all the files in the /install/schemas folder:(except schema_data.sql)

Code: Select all

 user_points int(11) DEFAULT '0' NOT NULL
Image

User avatar
bbrian017
Member
Member
Posts: 64
Joined: 12 Apr 2007, 21:36

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby bbrian017 » 21 Jun 2007, 20:10

from the error message do you think the other command went through in the database alright?

and does it matter where I add it in every file because your find, isn't always there :(

User avatar
Ganon_Master
Past Contributor
Past Contributor
Posts: 311
Joined: 20 Nov 2006, 16:23
Real name: Hidde
Location: Soesterberg, Utrecht, The Netherlands

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby Ganon_Master » 21 Jun 2007, 21:05

bbrian017 wrote:from the error message do you think the other command went through in the database alright?


No. The error says that PHP tried to find the user_points field in the database, but couldn't find it.

bbrian017 wrote:and does it matter where I add it in every file because your find, isn't always there :(


Search for similair lines.
Image


User avatar
poyntesm
Member
Member
Posts: 70
Joined: 19 Oct 2006, 10:13
Location: Dublin, Ireland

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby poyntesm » 15 Aug 2007, 19:00

If you are adding lots of tables or new field i HIGHLY recommend you look at create_schema_files.php in the /develop folder in the CVS.

In there you store the schema as an array and then let the script generate the schema files. This is better than editing the schema files as datatypes can be different across the DBMS that phpBB supports.

User avatar
Lord Le Brand
Website Team
Website Team
Posts: 223
Joined: 08 Sep 2006, 15:44
Real name: Leroy
Location: Parkstad, Limburg, the Netherlands (GMT+1)

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby Lord Le Brand » 29 Aug 2007, 20:03

good thing i was bored and checked this topic :o
Thanks for that tip poyntesm! :) VERY useful for phpBB Project
Image

User avatar
poyntesm
Member
Member
Posts: 70
Joined: 19 Oct 2006, 10:13
Location: Dublin, Ireland

Re: Adding sql database inserts to phpbb3.0 Install Script

Postby poyntesm » 29 Aug 2007, 20:08

Yes, very important. I have a post nearly ready on it all.


Return to “phpBB Development discussion”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 2 guests