On saving of Pod with multiple fields, use dbDelta #6762
sc0ttkclark
started this conversation in
Ideas
Replies: 1 comment
-
dbDelta makes a lot of sense here to reduce overall logic |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Issue Overview
When saving a pod with multiple fields, each field gets added individually. That's OK but they get added to the DB before all fields are properly validated. What we should do is save the fields to the config and then do the
dbDelta()
at the end of that saving routine so we catch any problems per field that would send back an error.This prevents cases where you add 2+ fields, save the pod, one of the later fields has an error, and then when you fix that error and save again there's an SQL error that the DB column already exists.
Beta Was this translation helpful? Give feedback.
All reactions