I can't convince my team that a good database model promotes a good API design and a good UI/UX experience.

Instead, I have to work with a ridiculous table setup.

Imagine, if you will, a table (table B) that references another table (table A) via a foreign key. The FK is a string in both tables. And table A only has one column, which is labeled as "name".

The schema i have to look at it kind of like this:

Table parent
Name varchar(10) primary key

Table child
Name varchar (10),
parent_name varchar(10),
Foreign key (parent_name) references parent (name)

Sorry if the syntax is wrong, a little frustrated having to look at it...

Am I crazy to want to change this table design? Am I missing something? I feel like I'm taking crazy pills, because this is just scratching the surface of the problems I have to deal with.

  • 1
    What SQL is this? How many are tables using these 2?
  • 2
    I’m no database expert by any stretch, but why the hell would you have the table with just the name in it if there are only two tables, surely there is no need for a relationship. one table would suffice?
  • 3
    Using strings as foreign keys is a really bad choice performance wise but if its a table which will have a small amount of rows (like less than 1000) from now and forever, then that is not a big deal. On the other hand. I think its dumb to use two tables to represent a parent-child relationship. They do know that a table can refer to itself? 😃
  • 0
    @sunfishcc mysql, there are 4 tables total...
  • 0
    @coopaaaah @arekxv Yeah. Using string... That's why I'm asking what database this is.
  • 1
    @arekxv I'm sure they do. In some cases the parent will be very small, but the child table it's referencing certainly won't.

    The project is about managing batch jobs. In this scenario, the parent here would be a app, and the child is the batch that ran for that app. With how they've designed it, a row would be created for each batch that's run for said app.

    The state of said batch is also managed in that table. I tried to expand it out and say this would not preform well, especially for the UI,but I couldn't get anywhere with them.
  • 2
Your Job Suck?
Get a Better Job
Add Comment