Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Huh, this got me thinking.

How about you just give a UUID to everything in the schema?

The technical challenge with generated scripts (that you could edit by hand, but that just means that you now don't have an automated system) is that they don't understand changes at a deep enough level - they lack the context to see that a table or column has been renamed because they have no understanding of identity.

So - just give them identity.

  Schema at commit 20b1ea23

  03496418-e44c-42a6-a6a4-6563b7ae7bfb users
    25233812-9a95-4bc3-893e-6accb935fa49 name
    2f4c79c3-81b6-42d4-8379-ce5f0ed8ef62 address
    83fc34c8-56c7-49d4-94d0-150cd76204bc password

  Schema at commit c0d07562

  03496418-e44c-42a6-a6a4-6563b7ae7bfb users
    89482484-8205-40ad-a73b-a1bb988dc1d9 firstname
    25233812-9a95-4bc3-893e-6accb935fa49 lastname
    2f4c79c3-81b6-42d4-8379-ce5f0ed8ef62 address
    c9f0d35d-439e-488c-a6d5-7a144c54335c address2
    83fc34c8-56c7-49d4-94d0-150cd76204bc password
Now you could diff these two:

  @@ -1,4 +1,6 @@
   03496418-e44c-42a6-a6a4-6563b7ae7bfb users
  -    25233812-9a95-4bc3-893e-6accb935fa49 name
  +    89482484-8205-40ad-a73b-a1bb988dc1d9 firstname
  +    25233812-9a95-4bc3-893e-6accb935fa49 lastname
       2f4c79c3-81b6-42d4-8379-ce5f0ed8ef62 address
  +    c9f0d35d-439e-488c-a6d5-7a144c54335c address2
       83fc34c8-56c7-49d4-94d0-150cd76204bc password
and every line of the diff has the necessary information to decide what operation you intended.


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: