To manage database schemas, tables and columns, the plugin often generates HTML elements, CSS classes and JavaScript variables in the back-end with their original names. Unfortunately, MySQL, HTML, CSS and jQuery all have their own limitations, which can easily lead to errors or missing features. This page describes which characters can be used in schema, table and column names without breaking plugin features or running into name based errors.
Name validation #
Name validation was introduces in version 4.2.8 to help plugin users to identify erroneous names. Name validation is performed in the back-end only (Data Explorer, Data Tables, Data Projects, and so on). A red flag is shown when a schema, table or column names does not follow the general rules as mentioned below.
NOTE For performance reasons red flags are only shown at table level. Further research might be needed to identify the erroneous name.
General rules #
To prevent errors or missing plugin features, schema, table and column names should:
- Start with a letter
- Followed by any number of:
- Letters (upper or lower case)
- Digits 0 to 9
- Underscores (often used to replace white spaces)
- Be no longer than 64 characters
This works for all tools used in WP Data Access. To be safe, do not use anything else for names.
Example #
MySQL accepts white spaces in schema, tables and column names. HTML element names, CSS classes and JavaScript variables do not.
The following create table statement is allowed in MySQL:
create table my demo
(my id int not null auto_increment primary key
,my text text
);
The plugin however, will not be able to support all features with white spaces in the table and column name.
The following create table statement solves this issue:
create table my_demo
(my_id int not null auto_increment primary key
,my_text text
);
What to do if I get a red flag? #
- Check your schema, table, and column names
- Find the name(s) that do not follow the general rules
- Change the name
You might need to take additional actions for schema, table, and column names that are already used in data tables or projects.
