Log in

View Full Version : Missing SQL


thepoetwarrior
08-14-2011, 09:25 AM
I updated my database for the first time in a long time, and char select screen showed my characters naked, and I couldn't log in.

Checking the logs and found out fields are missing in the items table.

I searched for sql's to be sourced in with the missing fields, but they were never included with the udpated source code.

Here is the query I did to fix it.

ALTER TABLE `items` ADD COLUMN `powersourcecapacity` smallint(6) NOT NULL DEFAULT '0' AFTER `expendablearrow`;
ALTER TABLE `items` ADD COLUMN `bardeffect` smallint(6) NOT NULL DEFAULT '0' AFTER `powersourcecapacity`;
ALTER TABLE `items` ADD COLUMN `bardeffecttype` smallint(6) NOT NULL DEFAULT '0' AFTER `bardeffect`;
ALTER TABLE `items` ADD COLUMN `bardlevel2` smallint(6) NOT NULL DEFAULT '0' AFTER `bardeffecttype`;
ALTER TABLE `items` ADD COLUMN `bardlevel` smallint(6) NOT NULL DEFAULT '0' AFTER `bardlevel2`;
ALTER TABLE `items` ADD COLUMN `bardunk1` smallint(6) NOT NULL DEFAULT '0' AFTER `bardlevel`;
ALTER TABLE `items` ADD COLUMN `bardunk2` smallint(6) NOT NULL DEFAULT '0' AFTER `bardunk1`;
ALTER TABLE `items` ADD COLUMN `bardunk3` smallint(6) NOT NULL DEFAULT '0' AFTER `bardunk2`;
ALTER TABLE `items` ADD COLUMN `bardunk4` smallint(6) NOT NULL DEFAULT '0' AFTER `bardunk3`;
ALTER TABLE `items` ADD COLUMN `bardunk5` smallint(6) NOT NULL DEFAULT '0' AFTER `bardunk4`;
ALTER TABLE `items` ADD COLUMN `bardname` varchar(64) NOT NULL DEFAULT '' AFTER `bardunk5`;
ALTER TABLE `items` ADD COLUMN `bardunk7` smallint(6) NOT NULL DEFAULT '0' AFTER `bardname`;
ALTER TABLE `items` ADD COLUMN `UNK214` smallint(6) NOT NULL DEFAULT '0' AFTER `bardunk7`;

Where did I miss the sql update when updating the source code? I sourced in all sql files including the optional ones.

Derision
08-14-2011, 03:07 PM
What I believe happened with the bard related ones, is that they were added to the PEQ database at some point (probably when CD updated the items table from 13th floor data),
but they were unused in the code.

When I fixed the display of bard instrument mods for Underfoot in Rev1867, I had to make use of those columns. As far as I was concerned at the time, I didn't need to include
an SQL update with the code, since the columns were already in the database, although Trevius did note in a comment on the commit that people using custom databases rather
than PEQ would have to manually add those columns.

thepoetwarrior
08-14-2011, 03:15 PM
I started from a PEQ Database of about 4 years ago and been customizing that database since, without downloading a new version of the database. I just been doing the source *.sql files each time I do source code update. So I guess other server admins that started with an older version of the database would have had same problems some time this year when updating their source code. Took me 3 hours of trying to figure out what I missed until I discovered I needed to add some columns manually. Would be good info to put into the changelog file or something =)

Thanks for the reply, makes sense.