Skip to content
  • Jamie Tanna's avatar
    d0473587
    Fix: Ensure `UNIQUE`s work on `renovate` · d0473587
    Jamie Tanna authored
    As noticed in #88, multiple imports of the same data was leading to an
    increase in entries in the `renovate` table, which shouldn't have been
    possible.
    
    The entries that are duplicated all appear to have `dep_types = NULL`,
    and digging into this further, this is due to SQLite treating `NULL`s
    differently in `UNIQUE` constraints[0].
    
    However, this doesn't seem to be super straightforward, as we want to
    have the `ON CONFLICT` in the schema, but that's not possible in a
    standalone index[1].
    
    One option is a partial index[2], but as we use this as a JSON array - and
    we already have some handling for (de)serialising it when `NULL` - we
    can simplify this and replace it with it always being an empty array.
    
    This is a breaking change, as we are changing the underlying schema for
    a table that may be relied upon.
    
    Closes #88.
    
    [0]: https://stackoverflow.com/a/47522530
    [1]: https://stackoverflow.com/a/51938871
    [2]: https://stackoverflow.com/a/68215933
    d0473587
    Fix: Ensure `UNIQUE`s work on `renovate`
    Jamie Tanna authored
    As noticed in #88, multiple imports of the same data was leading to an
    increase in entries in the `renovate` table, which shouldn't have been
    possible.
    
    The entries that are duplicated all appear to have `dep_types = NULL`,
    and digging into this further, this is due to SQLite treating `NULL`s
    differently in `UNIQUE` constraints[0].
    
    However, this doesn't seem to be super straightforward, as we want to
    have the `ON CONFLICT` in the schema, but that's not possible in a
    standalone index[1].
    
    One option is a partial index[2], but as we use this as a JSON array - and
    we already have some handling for (de)serialising it when `NULL` - we
    can simplify this and replace it with it always being an empty array.
    
    This is a breaking change, as we are changing the underlying schema for
    a table that may be relied upon.
    
    Closes #88.
    
    [0]: https://stackoverflow.com/a/47522530
    [1]: https://stackoverflow.com/a/51938871
    [2]: https://stackoverflow.com/a/68215933
Loading