Stories
Slash Boxes
Comments

Slash Open Source Project

Slashcode Log In

[ Create a new account ]

Article Poll

I found this article to be
Very Helpful
Helpful
Not Helpful
Not Very Helpful
[ Results | Polls ]
Comments:0 | Votes:3

How to Allow Longer Subjects?

posted by jamiemccarthy on 03:34 PM August 30th, 2003   Printer-friendly   Email story
An anonymous reader asks: "By default there is a limit on how long a poster's subject can be. Is there a way to get beyond this limitation, so that the subject lines for comments and stories can be longer?" Sure, it's easy... this is a good introduction to using MySQL to customize Slash.

I assume "poster's subject" refers to the subject field for comments.

The first step is to increase the size in the database. Right now, a DESCRIBE comments will show you that the max size, as we ship the code, is 50. To bump that to 100 in the table, open up your MySQL client with mysql -u username databasename (add -p if you have a password). Then: ALTER TABLE comments CHANGE COLUMN subject subject VARCHAR(100) NOT NULL DEFAULT ''

(If you wanted to change the VARCHAR size, but forgot the syntax and settings for NOT NULL and DEFAULT, a SHOW CREATE TABLE comments will remind you.)

I haven't actually tried it, but I just looked over the code to see if we truncate the comment subject in perl before inserting it into the DB. It looks like we do not -- that we just let the DB truncate if necessary. Which is good. So the ALTER TABLE should be the only command necessary!

As for stories, it looks like we ship stories.title as a VARCHAR(100) -- you can probably guess now how to increate that limitation too.

This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • accessing db..

    (Score:1)
    by hdisgd (5356) on Thursday September 04, @12:46PM (#6126)
    as an inexperienced user of mysql... how do i connect to slash's database... or mysql under slash... via the shell?