Well, it was a big failure, unfortunately. I have our DBA looking at it to try to figure out why. We tried to add partitions to the fact_names, fact_values, logs, audits and reports tables. We used pg_partman for this. In order for it to work, we had to modify the tables as such:
ALTER TABLE $table_name ALTER COLUMN created_at SET NOT NULL;
When we started Foreman back up, we had all kinds of problems. One of the errors I managed to catch was:
STATEMENT: SELECT 1 AS one FROM "fact_values" WHERE "fact_values"."fact_name_id" IS NULL and "fact_values"."host_id" = $1 LIMIT $2
ERROR: null value in column "fact_name_id" violates non-null constraint
DETAIL: Failing row contains (360774385, $ipaddress, null, 217538, $datestamp, $datestamp).
CONTEXT: SQL statement "INSERT INTO public.fact_values_p2020_07_27 VALUES (NEW.*)"
public.fact_values_p2020_07_27 is one of the partition tables for fact_values.
Now, I don’t know if it mattered or not, but, when I did the upgrade, I dumped the database but excluded data from the tables I mentioned above. So when we started Foreman with 1.21, the tables were empty.