Skip to content

Bug: Migrations do not support hyphens #9177

@wrongecho

Description

@wrongecho

PHP Version

8.2

CodeIgniter4 Version

4.5.5

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MariaDB 11.3.2

What happened?

Migration files created with php spark make:migration fail to be detected by migrate:status if hyphens (-) are used in the name.

Steps to Reproduce

PS C:\wamp64\www\codeigniter> php spark make:migration my-first-migration

CodeIgniter v4.5.5 Command Line Tool - Server Time: 2024-09-07 16:58:44 UTC+00:00

File created: APPPATH\Database\Migrations\2024-09-07-165844_My-first-migration.php

PS C:\wamp64\www\codeigniter> php spark migrate:status

CodeIgniter v4.5.5 Command Line Tool - Server Time: 2024-09-07 16:58:46 UTC+00:00

+----------------------+-------------------+---------------------+---------+---------------------+-------+
| Namespace            | Version           | Filename            | Group   | Migrated On         | Batch |
+----------------------+-------------------+---------------------+---------+---------------------+-------+
| CodeIgniter\Shield   | 2020-12-28-223112 | create_auth_tables  | default | 2024-09-07 16:36:09 | 1     |
| CodeIgniter\Settings | 2021-07-04-041948 | CreateSettingsTable | default | 2024-09-07 16:36:09 | 1     |
| CodeIgniter\Settings | 2021-11-14-143905 | AddContextColumn    | default | 2024-09-07 16:36:09 | 1     |
+----------------------+-------------------+---------------------+---------+---------------------+-------+

Expected Output

PS C:\wamp64\www\codeigniter> php spark make:migration my_first_migration

CodeIgniter v4.5.5 Command Line Tool - Server Time: 2024-09-07 16:59:00 UTC+00:00

File created: APPPATH\Database\Migrations\2024-09-07-165900_MyFirstMigration.php

PS C:\wamp64\www\codeigniter> php spark migrate:status

CodeIgniter v4.5.5 Command Line Tool - Server Time: 2024-09-07 16:59:02 UTC+00:00

+----------------------+-------------------+---------------------+---------+---------------------+-------+
| Namespace            | Version           | Filename            | Group   | Migrated On         | Batch |
+----------------------+-------------------+---------------------+---------+---------------------+-------+
------------> **_| App                  | 2024-09-07-165900 | MyFirstMigration    | ---     | ---                 | ---   |_** <------------
| CodeIgniter\Shield   | 2020-12-28-223112 | create_auth_tables  | default | 2024-09-07 16:36:09 | 1     |
| CodeIgniter\Settings | 2021-07-04-041948 | CreateSettingsTable | default | 2024-09-07 16:36:09 | 1     |
| CodeIgniter\Settings | 2021-11-14-143905 | AddContextColumn    | default | 2024-09-07 16:36:09 | 1     |
+----------------------+-------------------+---------------------+---------+---------------------+-------+

Anything else?

Please accept my apologies if this was previously reported, or if I am doing something incorrectly. I am new to CodeIgniter and this caused me a lot of grief when following the docs at https://codeigniter.com/user_guide/dbmgmt/forge.html

Thank you for your time :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions