[Django] #33466: Schema Modification using Migrations

25 views
Skip to first unread message

Django

unread,
Jan 28, 2022, 2:36:24 AM1/28/22
to django-...@googlegroups.com
#33466: Schema Modification using Migrations
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
kenprogrammer |
Type: New | Status: new
feature |
Component: | Version: 4.0
Migrations | Keywords: migrations,column
Severity: Normal | after,mysql
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
MySQL Specific: Let's say I've a table with columns **first_name,
last_name, address**'''' later on I may need to add column ''middle_name''
**** AFTER ''first_name''****

Currently there no way to do this using migrations. I've checked''
RunSQL''**** but I don't whether this is the way of doing it.

--
Ticket URL: <https://code.djangoproject.com/ticket/33466>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 28, 2022, 2:38:28 AM1/28/22
to django-...@googlegroups.com
#33466: Schema Modification using Migrations
-------------------------------------+-------------------------------------
Reporter: kenprogrammer | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 4.0
Severity: Normal | Resolution:
Keywords: migrations,column | Triage Stage:
after,mysql | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by kenprogrammer:

Old description:

> MySQL Specific: Let's say I've a table with columns **first_name,
> last_name, address**'''' later on I may need to add column
> ''middle_name'' **** AFTER ''first_name''****
>
> Currently there no way to do this using migrations. I've checked''
> RunSQL''**** but I don't whether this is the way of doing it.

New description:

MySQL Specific: Let's say I've a table with columns **first_name,

last_name, address**'''' later on I may need to add column **middle_name**
''''AFTER **first_name**''''

Currently there no way to do this using migrations. I've checked''
RunSQL''**** but I don't whether this is the way of doing it.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33466#comment:1>

Django

unread,
Jan 28, 2022, 2:41:07 AM1/28/22
to django-...@googlegroups.com
#33466: Schema Modification using Migrations
-------------------------------------+-------------------------------------
Reporter: kenprogrammer | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 4.0
Severity: Normal | Resolution:
Keywords: migrations,column | Triage Stage:
after,mysql | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by kenprogrammer:

Old description:

> MySQL Specific: Let's say I've a table with columns **first_name,


> last_name, address**'''' later on I may need to add column

> **middle_name** ''''AFTER **first_name**''''


>
> Currently there no way to do this using migrations. I've checked''
> RunSQL''**** but I don't whether this is the way of doing it.

New description:

MySQL Specific: Let's say I've a table with columns **first_name,

last_name, address** later on I may need to add column **middle_name**
AFTER **first_name**

Currently there no way to do this using migrations. I've checked''
RunSQL''**** but I don't whether this is the way of doing it.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33466#comment:2>

Django

unread,
Jan 28, 2022, 2:52:37 AM1/28/22
to django-...@googlegroups.com
#33466: Schema Modification using Migrations
-------------------------------------+-------------------------------------
Reporter: kenprogrammer | Owner: nobody
Type: New feature | Status: closed
Component: Migrations | Version: 4.0
Severity: Normal | Resolution: invalid

Keywords: migrations,column | Triage Stage:
after,mysql | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

Does the order in which the columns are added to the table really matter
to you? I cannot image any scenario where this could be an issue. You can
always do this in 4 steps:
- create a new model with a temporary name,
- copy data between models,
- drop old model,
- rename new model to the target name.

--
Ticket URL: <https://code.djangoproject.com/ticket/33466#comment:3>

Django

unread,
Jan 28, 2022, 2:53:47 AM1/28/22
to django-...@googlegroups.com
#33466: Specify the order of columns in the table.
-------------------------------------+-------------------------------------
Reporter: Kennedy Mwenda | Owner: nobody

Type: New feature | Status: closed
Component: Migrations | Version: 4.0
Severity: Normal | Resolution: invalid
Keywords: migrations,column | Triage Stage:
after,mysql | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/33466#comment:4>

Reply all
Reply to author
Forward
0 new messages