Thursday, August 25, 2016

Re: What is this? CASCADE clausule on DROP COLUMN???

Hi,

I searched for it, and looks like Django uses a general schema constants for common commands (like ALTER). It is stored inside a class, which is the parent class of the rest of the RDBMS schemas. And it isn't replaced, so it justs assumes the value of the parent.

More info https://github.com/django/django/tree/master/django/db/backends . Search in base/schema.py and mysql/schema.py

Would be nice if some could do a pull request modifying the command for MySQL, only to not get the error syntax (it is just a negative trim).

El jueves, 25 de agosto de 2016, 18:19:54 (UTC+2), Erik Cederstrand escribió:

> Den 25. aug. 2016 kl. 17.09 skrev RompePC <durillo...@gmail.com>:
>
> I did a migration of Django, and then applied a sqlmigrate, giving me this output...
>
> BEGIN;
> --
> -- Remove field my_column from my_table
> --
> ALTER TABLE `my_table` DROP COLUMN `my_column` CASCADE;
>
> I don't find info about it, and I've never seen something like this in my MySQL experience. And the best part is that works (although it is marked as a syntax error). Can anyone throw me some light about it?

Are you using MySQL as your backend? I believe that syntax is only for postgresql. CASCADE defines what to do if anything outside the table references the column. CASCADE will drop these references.

Erik

--
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/13666621-fe59-4e65-8b9e-630e5d581c09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment