PostgreSQL Schema

The Insight Service reads and writes one table in the shared FloatMe RDS PostgreSQL cluster (ebdb), through a main pool for writes and a replica pool for reads. Connection, secret, and VPC details are in Infrastructure.

FloatMeAPI_employmentinfomodel

Django-managed table owned by the FloatMe monolith. A user may have several rows; the service treats the highest id as the current record.

Column Go field Description

id

Employment.ID

Auto-increment primary key; ORDER BY id DESC LIMIT 1 selects the current record

user_id_id

Employment.UserID

FloatMe user ID (Django foreign-key column)

employer_name

Employment.Name

Employer name; matched against Pave income descriptions in Pave V1 selection

pay_type

Employment.PayType

Free-text pay type (hourly, salary); stored and returned, not used in prediction

pay_frequency

Employment.PayFrequency

weekly, bi-weekly, bi-monthly or semi-monthly, monthly in any casing; drives FloatMe V1 and the pay-frequency gate

payday

Employment.InitialPayday

Anchor payday date for the FloatMe V1 cadence calculation

Source: pkg/employment/repository.go, pkg/employment/employment.go

Access Patterns

Operation Pool Callers

GetPrimary(user_id) — latest row

Replica

Payday prediction; feeder and replay feeder (pay-frequency gate); employment create and update (previous pay frequency); GET /{user_id}/insights/employment and /insights/v2/employment

List(user_id) — all rows

Replica

None

Add(employment) — INSERT

Main

POST and PUT /{user_id}/insights/employment

Delete(user_id) — DELETE every row for the user

Main

DELETE /{user_id}/insights/employment; income verification save; institution-change handler

Source: pkg/employment/repository.go

Delete is idempotent: deleting a user with no rows succeeds.