Changes between Initial Version and Version 1 of Ticket #34151, comment 13


Ignore:
Timestamp:
Mar 10, 2023, 1:09:43 AM (22 months ago)
Author:
Bhuvnesh

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34151, comment 13

    initial v1  
    11OK, so i did some more work on this and found that it is much more complicated than i thought it would be:
    22
    3 1. You CANNOT switch pk field type if you already have some data in it without custom operations.
    4 2. the naive solution could be to remake all the tables that are referencing to a model's pk but even that is not possible in MySql as we cannot drop a table if it is referenced by other table.(throws error in case when 2 models are related to each other)
    5 3. the only solution i can think of (and tried) is deleting all related models and then recreating them with new uid field.
     31. the naive solution could be to remake all the tables that are referencing to a model's pk but even that is not possible in MySql as we cannot drop a table if it is referenced by other table.(throws error in case when 2 models are related to each other)
     42. the only solution i can think of (and tried) is deleting all related models and then recreating them with new uid field.
     53. One more way to do this can be to turn off FOREIGN_KEYS_CHECKS and then remake table, but that can be risky and can lead to data inconsistencies.
    66
    77So i'm deassigning myself in case someone has a better solution.
Back to Top