robinNcode / db_craft

DB Craft - CodeIgniter 4 Seeder, Migration Generator
14 stars 2 forks source link

Bug: Database names with dash not working #6

Open hirsm opened 2 months ago

hirsm commented 2 months ago

Hi and thanks for your great tool.

I am facing a problem regarding table names with dashes, because they lead to exceptions. It is however working when adding backticks just like in php spark get:migration `my-table` but you have to work-up the migration files by hand afterwards to remove the backticks in places where they do not belong.

robinNcode commented 2 months ago

@hirsm Thanks for your kind feedback. It is not good practice to write table names with dashes in MySql. Check out this small conversation with Chat-GPT is it a good practice to write MySQL table name with dash like "student-info"? Still, if you want me to resolve this mentioned exception, I will do it in the next patch.

hirsm commented 2 months ago

@robinNcode you are absolutely right, it really is bad practise to write table names with dashes (and I will not do it again^^). However, I think I will not be the only doing it so I would kindly appreciate a fix if you have the time for it.