So for instance:
{{{
class T(models.Model):
field = models.SmallIntegerField()
}}}
will create a table:
{{{
CREATE TABLE `app_t` (
...
`field` smallint(6) NOT NULL,
...
) ENGINE=InnoDB
}}}
Changing the field definition to:
{{{
...
field = models.IntegerField()
...
}}}
will create a migration:
{{{
...
migrations.AlterField(
model_name='t',
name='field',
field=models.IntegerField(),
)
...
}}}
resulting in the SQL
{{{
ALTER TABLE `app_t` MODIFY `field` integer
}}}
resulting in the table:
{{{
CREATE TABLE `app_t` (
...
``field` int(11) DEFAULT NULL,
...
)
}}}
This applies to 1.7 through 1.8.
--
Ticket URL: <https://code.djangoproject.com/ticket/24595>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Could you check if this is a duplicate of #23678?
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:1>
* Attachment "24595-test.diff" added.
test failure
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:2>
* owner: nobody => claudep
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:3>
* owner: claudep =>
* status: assigned => new
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:5>
Comment (by claudep):
Is schema corruption bugs considered having the same severity as data loss
bugs? I'd say yes, and if it is confirmed, the patch should then also be
backported to 1.7.x. Thoughts?
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:6>
Comment (by timgraham):
Okay with me.
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:7>
* owner: => Claude Paroz <claude@…>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"02260ea3f61b2fe0a0178528526101ff578c7400" 02260ea]:
{{{
#!CommitTicketReference repository=""
revision="02260ea3f61b2fe0a0178528526101ff578c7400"
Fixed #24595 -- Prevented loss of null info in MySQL field alteration
Thanks Simon Percivall for the report, and Simon Charette and Tim
Graham for the reviews.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:8>
Comment (by Claude Paroz <claude@…>):
In [changeset:"bbfcd9618b06556a0ae2c38456ef38bf3bea9e9d" bbfcd961]:
{{{
#!CommitTicketReference repository=""
revision="bbfcd9618b06556a0ae2c38456ef38bf3bea9e9d"
[1.8.x] Fixed #24595 -- Prevented loss of null info in MySQL field
alteration
Thanks Simon Percivall for the report, and Simon Charette and Tim
Graham for the reviews.
Backport of 02260ea3f6 from master.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:9>
Comment (by Claude Paroz <claude@…>):
In [changeset:"ada0845ddaefb4437e1d49aa781fd87ed9628e8f" ada0845d]:
{{{
#!CommitTicketReference repository=""
revision="ada0845ddaefb4437e1d49aa781fd87ed9628e8f"
[1.7.x] Fixed #24595 -- Prevented loss of null info in MySQL field
alteration
Thanks Simon Percivall for the report, and Simon Charette and Tim
Graham for the reviews.
Backport of 02260ea3f61b from master.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:10>
* status: closed => new
* resolution: fixed =>
Comment:
The failures on Oracle shown in Jenkins tend to show that Oracle may also
be affected by this bug. I'll hand this over to a more knowledgeable
person, though.
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:11>
* owner: Claude Paroz <claude@…> => claudep
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:12>
* owner: claudep =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:13>
* has_patch: 1 => 0
* stage: Ready for checkin => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:14>
* status: new => closed
* owner: => Shai Berger <shai@…>
* resolution: => fixed
Comment:
In [changeset:"773ec512b1872d4090b2ff8a759a85cc0f505bb9" 773ec512]:
{{{
#!CommitTicketReference repository=""
revision="773ec512b1872d4090b2ff8a759a85cc0f505bb9"
[1.7.x] Fixed #24595 Oracle test failure
The only problem for Oracle was the test, which tested nullity on
text/char fields -- but Oracle interprets_empty_strings_as_null.
Backport of d5a0acc from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:15>
Comment (by Shai Berger <shai@…>):
In [changeset:"8363f217f2d60e73682e791f60b7f3c07a651316" 8363f217]:
{{{
#!CommitTicketReference repository=""
revision="8363f217f2d60e73682e791f60b7f3c07a651316"
[1.8.x] Fixed #24595 Oracle test failure
The only problem for Oracle was the test, which tested nullity on
text/char fields -- but Oracle interprets_empty_strings_as_null.
Backport of d5a0acc from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:16>
Comment (by shaib):
Well, for some reason the commit hook missed it on master, but just to
clarify,
[changeset:"d5a0accaa090e4e65486930dbddaae5ad72aca3d" d5a0acc] fixed the
problem there.
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:17>
Comment (by claudep):
Thanks Shai!
--
Ticket URL: <https://code.djangoproject.com/ticket/24595#comment:18>