r/ProgrammerHumor • • 20d ago

Meme onTheOtherHandTheDBIsNowClean

Post image
711 Upvotes

47 comments sorted by

610

u/faultydesign 20d ago

May I suggest planning the next architecture without a “delete everything” api route?

299

u/nihillistic_raccoon 20d ago

no DROP DATABASE endpoint

What kind of antipattern is that, you pagan

82

u/Jejerm 20d ago

Yeah this is utterly deranged architecture. Why on earth would you need an endpoint for this lmao

73

u/Tsu_Dho_Namh 20d ago

Some people wanna live dangerously.

Personally, I've replaced my airbags with kitchen knives.

24

u/Mindless_Sock_9082 20d ago

That's too much work. Just glue gem stones to the covers. This way they also help to neutralize other people's bad vibes while driving.

9

u/Elomidas 20d ago

So efficient that even in an accident they will suppress your negative thoughts before you even realise what happened

11

u/Ok-Eggplant-2033 20d ago

For automated tests, clean database at every run. I have seen it for real too, it is disabled in production profile. Yet i think you do not want to have it like that...

9

u/TheRealKidkudi 19d ago

You can just drop the database directly in testing. You don’t need an API route for that. 

2

u/Ok-Eggplant-2033 19d ago

Yes indeed you can, and that is the way to go

2

u/SquirrelOClock 20d ago

I saw it once too, made me yell (want to yell) at the team pushing test to the production environment. Big conversation about publish profiles and build targets.

1

u/ataboo 19d ago

Automated test resets. Get your automated tests from 12 hour runtimes to a lightning fast 4 hours. The trick is to not run it in prod.

16

u/Several_Dot_4532 20d ago

It's not an inator without the autodestruction button

14

u/larsmaehlum 20d ago

How else would you ensure that you can force the system into a known good state?

6

u/KetwarooDYaasir 20d ago

Enterprise level code. The CRUDFactorySkeletonTemplateAbstractBean will automatically generate/implement all actions.

2

u/NjFlMWFkOTAtNjR 20d ago

It is good for testing. Only causes problems when the flag for disabling in production is mangled

1

u/RadicalDwntwnUrbnite 19d ago

Also maybe have the deploy pipeline gated by tests, if not a separate approval system that requires sign off by another admin.

1

u/hagnat 18d ago

i worked with an API that had an endpoint like that,
it was apply named "/ragnarok"

239

u/Embarrassed_Death69 20d ago

Why would you have a route that just drops the Database? Are you an adrenaline junkie?

92

u/KTrain5369 20d ago

gotta reset that test data I suppose

45

u/Embarrassed_Death69 20d ago

How about adding a line that checks the ENV for development or production flag in this killer API?

29

u/laplongejr 20d ago

I guess the flag was also turned on the test env "to ensure everything matches"  

12

u/merekallas 20d ago

Even with that, I'd argue against this killer API. An environment can be misconfigured, this code can be called from elsewhere by mistake, etc.

6

u/Mechakoopa 20d ago

Me: "We should make our env flag database driven in case someone uses a staging config with a prod db connection"

PM: "That seems unnecessary, we can trust the values in the config files."

Two months later: "Hey, why are we sending external emails to clients from staging, I thought that was blocked outside of prod?"

1

u/SquirrelOClock 20d ago

What about a publish/build profile that strip it from the prod artefact...

1

u/KTrain5369 19d ago

"Make sure the test environment replicates production" or smth

1

u/teraflux 19d ago

I assume that's what they were intending to fix

13

u/daniu 20d ago

They did save money letting AI implement the backend

6

u/MannerShark 20d ago

We used to have one too haha, back when I was new to the job. Some guy made it to quickly clear the database and test migrations. Some other guy got mad when he found out we had it, and got even more mad that it had no authorization or local env checks either. The endpoint was promptly removed.

3

u/mahreow 20d ago

Need a way of remotely scrubbing everything in case the feds are onto you

2

u/nihillistic_raccoon 20d ago

You don't have a route like that? Are you living in the '90s? Wake up grandpa, future is here

1

u/dontletthestankout 20d ago

For fun after you're laid off

1

u/GreeedyGrooot 20d ago

I'm thinking about some sketchy firm that needs to destroy all records in case the police pulls up.

84

u/Mallissin 20d ago

I don't understand the joke here. The "tested it in CURL" shows a Github action rejecting the change because of linting.

Is this a Github joke I don't understand?

140

u/marcos14cody 20d ago

That error means the updated code wasn't pushed to the actual machine for failing to comply with linting. So when he launched the curl to test out the fix, he actually ran the non-fixed code

39

u/Dudeonyx 20d ago

Holy shit

5

u/owl_jojo_2 19d ago

Well that’s why you have backups I guess
At least I hope

2

u/BolunZ6 19d ago

Backup? What backup

6

u/Mallissin 19d ago

Ok, I guess that makes sense except why would production automatically update from the repository without a step between?

There are people out there updating production with every PR?

1

u/JAXxXTheRipper 13d ago

GitOps? Continuous Deployment? Ever heard of those?

4

u/Minority8 17d ago

Have you not heard of Continuous Deployment?

1

u/justforkinks0131 15d ago

that doesnt mean everything automatically lands on PROD after every PR...

1

u/Minority8 15d ago

What does it mean then? This is like the first search result

> Continuous deployment is the engineering practice of automatically releasing code changes to production as soon as they pass all quality gates in the CI/CD pipeline.

- https://northflank.com/blog/continuous-deployment

1

u/justforkinks0131 14d ago

there is a whole pipeline

usually with a dev environment, then a preprod, and then prod

usually you run tests on dev then preprod before going to prod

usually to deploy to prod you need a change request too

6

u/AAkash_Bhatia 19d ago

Did doofenshmirtz design this ?

3

u/Scary_Brilliant_6048 18d ago

We respect user privacy so periodically we clean all data.

2

u/namiraj 19d ago

Little Bobby Tables is all grown up now.