Skip to content
  • Hartley McGuire's avatar
    8db97a70
    Fix change_column not setting precision for sqlite · 8db97a70
    Hartley McGuire authored
    There were a few 6.1 migration compatibility fixes in [previous][1]
    [commits][2]. Most importantly, those commits reorganized some of the
    compatibility tests to ensure that the tests would run against every
    Migration version. To continue the effort of improving test coverage for
    Migration compatibility, this commit converts tests for create_table and
    change_column setting the correct precision on datetime columns.
    
    While the create_table tests all pass, the change_column test did not
    pass for 7.0 versioned Migrations on sqlite. This was due to the sqlite
    adapter not using new_column_definition to set the options on the new
    column (new_column_definition is where precision: 6 gets set if no
    precision is specified). This happens because columns can't be modified
    in place in sqlite and instead the whole table must be recreated and the
    data copied. Before this commit, change_column would use the options
    of the existing column as a base and merge in the exact options (and
    type) passed to change_column.
    
    This commit changes the change_column method to replace the existing
    column without using the existing options. This ensures that precision:
    6 is set consistently across adapters when change_column is used to
    create a datetime column.
    
    (manually backported to 7-0-stable because it did not apply cleanly)
    
    [1]: c2f838e8
    [2]: 9b07b2d6
    8db97a70
    Fix change_column not setting precision for sqlite
    Hartley McGuire authored
    There were a few 6.1 migration compatibility fixes in [previous][1]
    [commits][2]. Most importantly, those commits reorganized some of the
    compatibility tests to ensure that the tests would run against every
    Migration version. To continue the effort of improving test coverage for
    Migration compatibility, this commit converts tests for create_table and
    change_column setting the correct precision on datetime columns.
    
    While the create_table tests all pass, the change_column test did not
    pass for 7.0 versioned Migrations on sqlite. This was due to the sqlite
    adapter not using new_column_definition to set the options on the new
    column (new_column_definition is where precision: 6 gets set if no
    precision is specified). This happens because columns can't be modified
    in place in sqlite and instead the whole table must be recreated and the
    data copied. Before this commit, change_column would use the options
    of the existing column as a base and merge in the exact options (and
    type) passed to change_column.
    
    This commit changes the change_column method to replace the existing
    column without using the existing options. This ensures that precision:
    6 is set consistently across adapters when change_column is used to
    create a datetime column.
    
    (manually backported to 7-0-stable because it did not apply cleanly)
    
    [1]: c2f838e8
    [2]: 9b07b2d6
Loading