Replies: 1 comment
-
Migrations are used for this https://payloadcms.com/docs/database/migrations |
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
-
I don't have as strong of a database background and am used to UIs doing most of the behind-the-scenes work for me. For that reason, I could use some help understanding what to do with the below.
Suppose I have two existing fields "first_name" and "last_name" inside collections/People.ts, and an entry with "John" and "Doe" in those respective fields.
I then create a new group field in People.ts called "name" and move "first_name" and "last_name" into that group.
In the admin, that entry no longer displays "John" and "Doe". It's clear why that happened from looking at the backend: the page is no longer displaying values from "first_name" or "last_name", and is instead now displaying a new "name" field that needs a value of {"first_name": "John", "last_name": "Doe"} entered before it'll display "John" and "Doe" on the page.
In that scenario, what's the process to (1) move any existing data from "first_name" and "last_name" to the new "name" field, and (2) delete "first_name" and "last_name" entirely once I'm done?
I'm guessing there's a common way to do this that's just not clear to me because of my inexperience. In case it's relevant, I'm doing my initial tests in Payload Cloud, but that'll be moving to a self-hosted docker setup soon.
Beta Was this translation helpful? Give feedback.
All reactions