5

Here is a gem I found when looking at the previous offshore team's database.

So apparently they didn't know that SQL has an ALTER TABLE command to add new columns. So they created a brand new table, version 2, THEN migrated all the data over, every single time a new field was needed.

Then of course they had to update all their code that previously looked at the original table and the clients had to resync data onto the tablets as well.

Maybe they thought it was a good solution since they don't know what database versioning is (something they also manually implemented) or that ORMs exist.

**Sanitized the table names but kept the general structure, casing, etc

CREATE TABLE [dbo].[TVP_NameHere] AS TABLE(
[NameTime] [datetime] NULL,
[NameId] [int] NULL,
[somethingId] [int] NULL,
[fooId] [int] NULL,
[Time] [int] NULL
)

CREATE TABLE [dbo].[TVP_NameHereV002] AS TABLE(
[NewColumnHere] [int] NULL,
[NameTime] [datetime] NULL,
[NameId] [int] NULL,
[somethingId] [int] NULL,
[fooId] [int] NULL,
[Time] [int] NULL
)

Comments
  • 2
    Wait till you get the message: "We get weird messages that a column can't be added to the live server... Why?"

    You know the client is a dumb fucktard who would microwave his head if you tell him long enough that this makes him smarter....

    ... Yup. They added so many columns to a table that the max number of columns was exceeded ( e.g. MySQL 4096... ).

    For "reasons"....

    😫😫😫😫😫😫😫😫😫😫
  • 1
    Wow, that tops the worst sql design I’ve ever seen, which up until this day was a table like this: ContactFirstName1, ContzctFirstName2…you get the idea.
  • 0
    @IntrusionCM oh jeez. Thank God I'm completely rebuilding this application. The horrors are numerous. It houses ePHI data too.
Add Comment