Skip to content

Commit a92bbd2

Browse files
authored
Merge pull request #728 from stronk7/database_identifiers
Expanded DB identifier sizes (tables and columns - MDL-76459)
2 parents d436192 + eb5fbd6 commit a92bbd2

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

docs/apis/plugintypes/assign/feedback.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ Assignment Feedback plugins are located in the `/mod/assign/feedback` directory.
3030

3131
:::important Plugin naming
3232

33-
The plugin name should be no longer than 13 characters - this is because the database tables for a submission plugin must be prefixed with `assignfeedback_[pluginname]` (15 chars + X) and the table names can be no longer than 28 chars due to a limitation with Oracle.
33+
The plugin name should be no longer than 38 (13 before Moodle 4.3) characters - this is because the database tables for a submission plugin must be prefixed with `assignfeedback_[pluginname]` (15 chars + X) and the table names can be no longer than 53 (28 before Moodle 4.3) chars due to a limitation with PostgreSQL.
3434

35-
If a plugin requires multiple database tables, the plugin name will need to be shorter to allow different table names to fit under the 28 character limit.
35+
If a plugin requires multiple database tables, the plugin name will need to be shorter to allow different table names to fit under the 53 character limit (28 before Moodle 4.3).
3636

37+
Note: If your plugin is intended to work with versions of Moodle older than 4.3, then the plugin name must be 13 characters or shorter, and table names must be 28 characters or shorter.
3738
:::
3839

3940
Each plugin is in a separate subdirectory and consists of a number of _mandatory files_ and any other files the developer is going to use.

docs/apis/plugintypes/assign/submission.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Assignment Feedback plugins are located in the `/mod/assign/submission` director
3030

3131
:::important Plugin naming
3232

33-
The plugin name should be no longer than 11 characters - this is because the database tables for a submission plugin must be prefixed with `assignsubmission_[pluginname]` (17 chars + X) and the table names can be no longer than 28 chars due to a limitation with Oracle.
33+
The plugin name should be no longer than 36 (11 before Moodle 4.3) characters - this is because the database tables for a submission plugin must be prefixed with `assignsubmission_[pluginname]` (17 chars + X) and the table names can be no longer than 53 (28 before Moodle 4.3) chars due to a limitation with PostgreSQL.
3434

35-
If a plugin requires multiple database tables, the plugin name will need to be shorter to allow different table names to fit under the 28 character limit.
35+
If a plugin requires multiple database tables, the plugin name will need to be shorter to allow different table names to fit under the 53 character limit (28 before Moodle 4.3).
3636

37-
:::
37+
Note: If your plugin is intended to work with versions of Moodle older than 4.3, then the plugin name must be 11 characters or shorter, and table names must be 28 characters or shorter.
3838

3939
Each plugin is in a separate subdirectory and consists of a number of _mandatory files_ and any other files the developer is going to use.
4040

docs/devupdate.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ import TabItem from '@theme/TabItem';
1212

1313
This page highlights the important changes that are coming in Moodle 4.3 for developers.
1414

15+
## Database table and column names
16+
17+
Starting with Moodle 4.3 the limits for both table and column names have been raised. Now table names can be up to 53 characters long (from previous 28 characters limit) and column names can be up to 63 characters long (from previous 30 characters limit).
18+
19+
:::caution
20+
In order to achieve the above, the maximum length for the database prefix (`$CFG->prefix`) is now 10 characters. Installation or upgrade won't be possible with longer prefixes.
21+
:::
22+
23+
:::caution
24+
If you are writing a plugin intended for older versions of Moodle then you must continue to use the lower limits of 28, and 30.
25+
:::
26+
1527
## Activity badge
1628

1729
The new activity card design proposed for Moodle 4.3 differentiates badge information from other HTML content (displayed using the pre-existing `afterlink` feature).

general/development/tools/xmldb.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ Apart from the [Database Structures guidelines](https://docs.moodle.org/dev/Data
7676

7777
1. About names:
7878
1. All lowercase names (tables, indexes, keys and fields).
79-
1. Table names and field names must use only a-z, 0-9 and _ chars. Max 28 characters.
79+
1. Table names and field names must use only a-z, 0-9 and _ chars. Max 53 characters for tables and 63 characters for fields (28 and 30 before Moodle 4.3).
80+
81+
:::caution
82+
If you are writing a plugin intended for older versions of Moodle then you must continue to use the lower limits of 28, and 30.
83+
:::
8084
1. Key and index names under the XMLDB Files must be formed by concatenating the name of the fields present in the key/index with the '"-" (minus) character.
8185
1. Primary key always must be named "primary" (this is one exception to the previous convention).
8286
1. It's highly recommended to avoid [reserved words](https://docs.moodle.org/dev/XMLDB_reserved_words) completely. We know we have some of them now but they should be completely out for next releases.

general/releases/4.3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Moodle supports the following database servers. Again, version numbers are just
3636
| [Microsoft SQL Server](http://www.microsoft.com/en-us/server-cloud/products/sql-server/) | 2017 | Latest |
3737
| [Oracle Database](http://www.oracle.com/us/products/database/overview/index.html) | 19 | Latest |
3838

39+
Note that, since Moodle 4.3, the maximum length for the database prefix (`$CFG->prefix`) is 10 characters. Installation or upgrade won't be possible with longer prefixes.
40+
3941
## Client requirements
4042

4143
### Browser support

0 commit comments

Comments
 (0)