• MacFrogMacFrog (unregistered)

    The field invoiced, also text, only holds “True” or “False” (or “Yes”, “y”, “Y”, “N”, “???”, NULL).

    Obviously, he missed "File Not Found"!

  • TheCPUWizard (unregistered)

    Try as I might I can not come up with a "Reasonable" encoding for "Last 4" that is over 56 characters.....Maybe I just need more caffeine....

  • JG (unregistered) in reply to TheCPUWizard

    MD5 encode each digit?

  • Will Kirkby (github) in reply to JG

    Security by absurdity

  • (nodebb) in reply to JG

    Maybe they want to make sure they could enter the number in words, for additional security. And because they have international customers, they have to prepare for every UTF-8 four digit number representation in every language.

  • Ron Fox (google)

    This last issue (last four digits of the card in a varchar(70) field) is just enterprisey - it allows for the potential case that in the future the value of 4 might become 70. Very forward looking :-P

  • (nodebb)

    Maybe they keep a comma separated list of the last four full credit card numbers that the user specified? Because shits and giggles.

  • Illogic (unregistered)

    Well, there is a four digit security code on the back of credit cards ...

  • Idiot Abroad (unregistered)

    Well you need 70 characters, of course, to store the string: "The last four digits are: nine-thousand, nine-hundred and ninety-nine."

  • Anonymous') OR 1=1; DROP TABLE wtf; -- (unregistered)

    Your database schema is bad and you should feel bad.

  • kktkkr (unregistered)

    Nine(9) thousant five hundred and hundred and hundred and hundred and c2V2ZW50eS0= EFBC90EFBD82EFBC90EFBC91EFBC91EFBC90.

    There is no limit to how badly you can represent a four-digit number, but it does take some serious WTFery to reach 70 characters. I'm going with the theory that they're storing four MD5 hashes in there for some arcane reason nobody really wants to know.

  • Webskale (unregistered)

    Sort of reminds me of the time I found a CSS class named "ArialRed". The text color was green.

  • BruceJ (unregistered)

    The real WTF? The stupid corporate system of "internal billing". Because you know what happens? The IT department estimates $50K worth of time for a gorram 2-day webpage workup because hey, that's how they get funded.

    What do you get? Timmy's, scattered throughout your enterprise like termites.

    At least the call center got the support they needed without having to wipe out their budget.

  • Anonymous (unregistered)

    Am I naive or is TRWTF the fact that the company charges interdepartment fees of 95$/hr for developing something that should have been part of the original customer service CRM software. If you give uninformed people the option of doing things right, or doing them cheaply, the will always choose the latter. So don't make people choose!

  • Carl Witthoft (google)

    Y'all are waaaay overthinking the field length WTFs. There's No Doubt (with apologies to Gwen) that the author of this code made some random guesses for lengths, and then randomly cut/pasted lengths from existing records to new ones he added when he felt like it.

  • Captain Obvious (unregistered)

    I just like the fact that you HAVE to put a comment in every row (comments text) because of course THAT is one of the most important fields in the entire table.

  • Replying to Sam (unregistered) in reply to TheCPUWizard

    What you do is design your sql table to handle everything in your giant excel. You don't want your vba to crash because some of the customer rows are a little wonky. The customer is always right.

  • All Stupid Dumb Things (unregistered) in reply to Captain Obvious

    You don't actually. Default value is "".

  • Monners (unregistered) in reply to Webskale

    And the font-family was Comic Sans?

  • I am error (unregistered)

    I like the fact that there are fields for valuation_date, ship_date AND num_of_days_from_ship_to_valuation_date.

    This guy knew that date-functions are scary and that there is no sure way to deduct one from another. Better save all the things.

  • Beep boop boop (unregistered)

    For the last 4 digits, should you use a int(4) field, or a varchar(4) field? Presumably the digits are always base-10 numeric? And if the last 4 digits are 0123, storing it as 123 is still a unique mapping, even though it 'looks' like 3 digits.

  • (nodebb) in reply to TheCPUWizard

    last_4_cus_number varchar(70) default NULL

    May be the customer number is less than 17 digits, and the field stores the previous 4 customer number seperated by some kind of seperator?

  • Lazerbaems (unregistered) in reply to Beep boop boop

    No, store it as a smallint. Then use vba to get the four digits by looking at each set of 4 bits in the number. It's BETTER

  • (nodebb)

    My favourite bit was "default NULL" on nearly every column (all except the one not null column and the text columns). Because if the value isn't specified on an insert, we want to make sure we put a NULL in that column rather than leaving it as a NULL.

  • Matt Westwood (unregistered) in reply to Webskale

    Frequent occurrence. You get a system where the names of the css classes reflect the content of the class rather than its purpose. so when it comes to a reskin, and all the colours change, you suddenly find you have a choice: either change the contents of the classes in the css file, thereby having examples similar to the above ArialRed containing green, or you go through the entire website finding all references to "ArialRed" and changing them to "Green".

    Or you rename the classes to things like "DefaultBackgroundColour", "DefaultTextColour", and so on, and slap the original designer upside t' head wit' cluebat.

  • Guest (unregistered) in reply to TheCPUWizard

    The last 4 number spelled in words, 70 varchar is too short!

  • Captain Obvious (unregistered) in reply to All Stupid Dumb Things

    Ah, my mistake. With some db engines, you have to actually specify a default value if you want one. I needed way more coffee yesterday than I drank.

  • Ray (unregistered) in reply to Illogic

    3 for Visa and Mastercard (at least here in Australia), 4 for AMEX.

  • ANaughtyMoose (unregistered)

    Interesting that the schema allows for addresses in non-US countries, but the phone number field is limited to 10 digits.

  • JamesB (unregistered)

    At least the length of middle_initial is correct!

  • v (unregistered)

    Wow, all this bitching at Timmy... I for one think he did a great job, considering his position.

  • M L (unregistered)

    To be frank, this database table is not bad at all. Column names are very expressive. And keeping all in one table probably came from just few columns initially, which grew to more as need arised. I have seen much worse examples of databases "Timmy" has done.

  • Belzebub (unregistered)

    I bet timmy is a big proponent of NOSQL databases

  • A Microsoftee (unregistered) in reply to Scarlet_Manuka

    You obviously never had the delight of working with SQL Server before 2004 - no field defaulted to NULL. It was a feature.....

  • lolz (unregistered) in reply to Webskale

    simply to fuck with the one colorblind webdesigner in the company? :D

Leave a comment on “Lunatic Schema-tic”

Log In or post as a guest

Replying to comment #:

« Return to Article