Applying migrations to (non-interactive) production server

50 views
Skip to first unread message

Carlos A. Carnero Delgado

unread,
Oct 2, 2014, 10:33:53 AM10/2/14
to django...@googlegroups.com
Hi,

I have succesfully upgraded an application to 1.7, and the time has come to apply a migration. In my development environment this is, as expected, a non issue; however, this particular application is hosted in a server where I'm not allowed to run interactive commands. This means that django-admin.py migrate is out of the question.

I've made a test with obtaining the SQL commands using sqlmigrate and then applying them to the production database -- which thankfully provides an interface to send SQL statements. So far, I have found no problems.

Is there another method? Am I missing something?

TIA,
Carlos.

Mike Dewhirst

unread,
Oct 2, 2014, 7:41:55 PM10/2/14
to django...@googlegroups.com
On 3/10/2014 12:31 AM, Carlos A. Carnero Delgado wrote:
> Hi,
>
> I have succesfully upgraded an application to 1.7, and the time has come
> to apply a migration. In my development environment this is, as
> expected, a non issue; however, this particular application is hosted in
> a server where I'm not allowed to run interactive commands. This means
> that django-admin.py migrate is out of the question.
>
> I've made a test with obtaining the SQL commands using sqlmigrate and
> then applying them to the production database -- which thankfully
> provides an interface to send SQL statements. So far, I have found no
> problems.
>
> Is there another method?

If you can get the server sysadmin to install fabric it might be
possible to make a fabfile which runs the command from your own machine.
http://docs.fabfile.org/en/1.10/index.html

Alternatively, a cron job on that server might run the migrate via a
script which first checks for the existence of a file in your project
and if the migration is successful, deletes the file.

Am I missing something?

You might need to offer the server sysadmin some incentive. They usually
like beer.



>
> TIA,
> Carlos.
>
> --
> 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...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjvz2mV3j5pmQZvvHpQA59meqmwqs5S%2BETapkX_TezNcbY4hg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPjvz2mV3j5pmQZvvHpQA59meqmwqs5S%2BETapkX_TezNcbY4hg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages