@accounter/server
Version:
Accounter GraphQL server
28 lines (27 loc) • 1.16 kB
TypeScript
import { sql } from 'slonik';
/**
* Change sort_codes primary key from (key) to (key, owner_id).
*
* Previously `key` was the sole PK (integer), which collides across tenants
* because different businesses legitimately use the same key values. The
* composite PK makes the uniqueness constraint per-tenant.
*
* Only financial_entities still has a sort_code column referencing sort_codes —
* businesses and tax_categories dropped theirs in 2024-02-26. The FK on
* financial_entities is dropped and re-added as a composite
* (sort_code, owner_id) → sort_codes(key, owner_id).
*
* Index changes:
* - DROP unique index hash_sort_codes_key_uindex (key alone — no longer unique)
* - New composite PK btree index replaces the old single-column PK
* - KEEP idx_sort_codes_owner_id for lookups by owner
* - ADD idx_sort_codes_owner_key on (owner_id, key) for owner-first lookups
*/
declare const _default: {
name: string;
run: ({ connection }: {
sql: typeof sql.unsafe;
connection: import("slonik").DatabaseTransactionConnection | import("slonik").DatabasePool;
}) => Promise<void>;
};
export default _default;