Any recommendations for adding a new required fiel...
# prisma-migrate
t
Any recommendations for adding a new required field to my datamodel without trashing the exiting data. I found older versions of Graphcool/Prisma had an @migrationValue directive but I don’t see an equivalent in newer versions (my project is currently on v 1.13).
n
1. adding an optional field 2. add data for this field to every node 3. make the field required
t
Thanks @nilan. Are there any examples in the community of automating this process - perhaps using post-deploy hooks?? If I don’t have to distribute and monitor this manual process among my whole team that’s ideal
n
I am not aware of such examples, no.
t
Ok. Thanks @nilan appreciate the help
h
Would prisma client be the suitable tool for this? From what I’ve heard it’s meant for writing scripts like this
t
@Henry interesting point. I guess in my opinion if the client can migrate schema (which sometimes requires a data migration) it should be able to migrate data too. I suppose this is a common problem for declarative schemas though
@Henry I think I misunderstood before. I just read what you said again and now it makes more sense. I’ll look into this, thank you
a
@nilan : can’t steps 1 and 2 be done at the same time with some default annotation?
n
no
s
@Arnab - we will implement support for this soon: https://github.com/prisma/prisma/issues/2323