Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#33466 closed New feature (invalid)

Specify the order of columns in the table.

Reported by: Kennedy Mwenda Owned by: nobody
Component: Migrations Version: 4.0
Severity: Normal Keywords: migrations, column after, mysql
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Kennedy Mwenda)

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.

Change History (4)

comment:1 by Kennedy Mwenda, 2 years ago

Description: modified (diff)

comment:2 by Kennedy Mwenda, 2 years ago

Description: modified (diff)

comment:3 by Mariusz Felisiak, 2 years ago

Resolution: invalid
Status: newclosed

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.

comment:4 by Mariusz Felisiak, 2 years ago

Summary: Schema Modification using MigrationsSpecify the order of columns in the table.
Note: See TracTickets for help on using tickets.
Back to Top