Skip to content

Force project naming to comply with MySQL DB naming schema, or convert it #32

@fernandocanizo

Description

@fernandocanizo

I decided to test Cody and when asked for a project name I used "codeCms Test" then I got an error on DB creation because you cannot have spaces in MySQL DB names.

This is the relevant output from create_site run:

6) Enter a location for storing documents: doc

{ [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Test default charset utf8' at line 1]
  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlState: '42000',
  index: 0 }
{ [Error: ER_NO_DB_ERROR: No database selected]
  code: 'ER_NO_DB_ERROR',
  errno: 1046,
  sqlState: '3D000',
  index: 0 }
{ [Error: ER_NO_DB_ERROR: No database selected]
  code: 'ER_NO_DB_ERROR',
  errno: 1046,
  sqlState: '3D000',
  index: 0 }
mkdir /home/conan/csoft/test/codycms/codyCms Test/controllers
mkdir /home/conan/csoft/test/codycms/codyCms Test/static
mkdir /home/conan/csoft/test/codycms/codyCms Test/static/css
mkdir /home/conan/csoft/test/codycms/codyCms Test/static/images
mkdir /home/conan/csoft/test/codycms/codyCms Test/static/js
mkdir /home/conan/csoft/test/codycms/codyCms Test/views
/home/conan/csoft/test/codycms/node_modules/cody/bin/create_site.js:131
                        if (err) throw err;
                                       ^
Error: ER_BAD_DB_ERROR: Unknown database 'codyCms Test'

The fix is simple, but you have two options: force appropriate project naming, like npm init does, or let the creator to use any name but convert it so wherever it's used, it has the correct syntax.

I'm inclined for the first option, but it's up to you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions