Thursday, April 19, 2018

Re: Adding stored procedures

Hi. 

Django migrations are run only once. If you want to change you stored procedure you always need a new migration.

In case of being last migration you could develop it by having drop clause im reverse migration. But if there is another migration(s) between current and new stored procedure you need to create new migration.

One option could be to hook pre- or post migration signal and apply your stored procedure there.


to 19. huhtikuuta 2018 klo 17.02 Chris Wedgwood <wedgemail@gmail.com> kirjoitti:
Thanks Matthew

I probably need to think about this some more

I think using runsql will work. Do you know if you can set migrations to be rerunnable? It would be useful to be able to change something like a stored procedure and then it gets dropped and recreated each deployment

Saying that the stored procedure is going to be used for an import task that isn't actually related to Django so probably needs to be deployed  by another mechanism and I should leave migrations for only DJango specific changes

thanks
Chris
 


On Wednesday, 18 April 2018 07:50:52 UTC+1, Chris Wedgwood wrote:
Hi All

I am using SQL SERVER in my latest django project and I am going to be using some stored procedures.

My question is about how to go about deploying stored procedure changes with django. I have looked through the migrations documentation which looks very specific to model changes.

Has anyone had experience of having to create other things such a stored procedures/views/functions?

thanks
Chris




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20a5ed5a-97f4-413b-8700-58606b781a2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHn91odLVAXZBkf8_VAdsRHU%2Biz11H73vzoRE-5dVB7QbHFA_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment