I am trying to write my own timestamps method that runs during migration. The one in place now adds a NOT_NULL constraint to the field, and I really don't want that.
The problem is that I have a database with multiple schemas. Where each major customer gets his own scheme. When we are on board a new customer, we create a new tenant record and then migrate for the new minted scheme.
The new scheme should be an exact copy of the tables in other schemes, except, of course, without data.
The last migration I encountered was to use a slightly older version of the rails. Still 3, but older. When he created the timestamps, they were NULLable. When I started the migration the other day (on new rails) ... Well, all the fields are now NOT_NULL
I have code that was developed with the idea that updated_at was only filled when the record was updated ... and not when it was created. (third-party applications and database “functions” create entries). Third-party applications and database functions that create records fall on the new schema ... I entered and removed all NOT_NULL restrictions in all tables manually, but I do not need to write the cleanup right to my migration task so that all future tables are fixed. .
I decided that it would be best to override the timestamps method, which was modified, back to the one that did not violate the existing code.
So, there is a reason why I need to return / redefine ..
My question is now ... How to redefine a method. I do not see a clear path to it, and I'm not quite sure how to redefine it ..
source
share