Populating a slug field in a migration #1226
Unanswered
sanderjson
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some number of Posts from
cargo loco g scaffold posts title:string content:text
and then later realize I want to reference url by slug and not by id.cargo loco g migration AddSlugToPosts slug:string
cargo logo db migrate
I want to be able to apply the migration that adds thew new schema and populate the column slug from
slugify(title)
How should I have handled this migration? Is there already some best practice with slugifying routes in loco? Is this a task for the manager? I read the docs on models & manager here, but I am not sure how to apply that to my task.
Beta Was this translation helpful? Give feedback.
All reactions