flip_api.db.seed.permissions

Functions

seed_permissions(→ list[str])

Seed permissions into the database, idempotently.

Module Contents

flip_api.db.seed.permissions.seed_permissions(session: sqlmodel.Session) list[str]

Seed permissions into the database, idempotently.

Idempotency is keyed on the permission id (the stable PermissionRef), not the name — matching seed_roles: a permission may be renamed while keeping its id, so a name-keyed check would miss the existing row and collide on the primary key when re-seeding a live database. An existing permission has its name/description refreshed in place so renames apply.

Parameters:

session (Session) – The SQLModel session used for reads and writes.

Returns:

All permission names present after seeding.

Return type:

list[str]