Moodle

Drop enums support

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Database SQL/XMLDB
  • Labels:
    None

Description

As commented in http://moodle.org/mod/forum/discuss.php?d=118852 it would be great to definitively drop support for enums in Moodle 2.0. It involves:

1) Transforming all (7) current enums to "normal" varchar fields (upgrade step in 1.9 => 2.0).
2) Drop enums/enumvalues from all the install.xml files (installation)
3) Drop enum support from XMLDB / tests / Dictionary Moodle DB functions completely (leaving only the option to drop them)
4) Document it properly (in 2.0 release Docs, in DB Layer 2.0 Docs and in contrib-related Docs.
5) In Moodle 2.1... drop the option of droppping enums (used in 3 under Moodle 2.0). Moodle 2.1 will require Moodle 2.0.

My +1 is here. If nothing arrives against that in the very next days... I'll do it. Ciao

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

yay! +1

Show
Petr Škoda (skodak) added a comment - yay! +1
Hide
Eloy Lafuente (stronk7) added a comment - - edited

Working on 1) Transforming all (7) current enums to "normal" varchar fields (upgrade step in 1.9 => 2.0).

Fields are:

enrol_authorize->paymentmethod
stats_daily->stattype
stats_weekly->stattype
stats_monthly->stattype
post->publishstate
forum->type
wiki->wtype

a) Set them to ENUM=false in install.xml files
b) Perform upgrade blocks
c) Disable ENUM creation in XMLDB stuff (exception).

With this addressed nobody will be able to introduce enums anymore.

Show
Eloy Lafuente (stronk7) added a comment - - edited Working on 1) Transforming all (7) current enums to "normal" varchar fields (upgrade step in 1.9 => 2.0). Fields are: enrol_authorize->paymentmethod stats_daily->stattype stats_weekly->stattype stats_monthly->stattype post->publishstate forum->type wiki->wtype a) Set them to ENUM=false in install.xml files b) Perform upgrade blocks c) Disable ENUM creation in XMLDB stuff (exception). With this addressed nobody will be able to introduce enums anymore.
Hide
Petr Škoda (skodak) added a comment -

maybe we could parse all existing install.xml files and automatically convert all of them, the enum=true in install.xml would be just ignored

Show
Petr Škoda (skodak) added a comment - maybe we could parse all existing install.xml files and automatically convert all of them, the enum=true in install.xml would be just ignored
Hide
Eloy Lafuente (stronk7) added a comment -

Step 1 implemented:

a) Set them to ENUM=false in install.xml files
b) Perform upgrade blocks
c) Disable ENUM creation in XMLDB stuff (exception), covering change_field_enum(), create_table(), create_temp_table() and add_field()

Show
Eloy Lafuente (stronk7) added a comment - Step 1 implemented: a) Set them to ENUM=false in install.xml files b) Perform upgrade blocks c) Disable ENUM creation in XMLDB stuff (exception), covering change_field_enum(), create_table(), create_temp_table() and add_field()
Hide
Eloy Lafuente (stronk7) added a comment - - edited

Working on 2) Drop enums/enumvalues from all the install.xml files (installation)

It includes:

a) erase all enum/enumvalues from all install.xml files
b) take out enum and enumvalues from .dtd and .xsd
c) default to enum=false everywhere
d) delete any trace of enums from XMLDB editor

Show
Eloy Lafuente (stronk7) added a comment - - edited Working on 2) Drop enums/enumvalues from all the install.xml files (installation) It includes: a) erase all enum/enumvalues from all install.xml files b) take out enum and enumvalues from .dtd and .xsd c) default to enum=false everywhere d) delete any trace of enums from XMLDB editor
Hide
Eloy Lafuente (stronk7) added a comment -

Added new http://cvs.moodle.org/contrib/tools/check_db_syntax/ script that detects all the dropped enum functions/xml/changes in parameters... and so on.

Don't get stressed, it shows some thousands of occurrences... will be fixed really soon.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Added new http://cvs.moodle.org/contrib/tools/check_db_syntax/ script that detects all the dropped enum functions/xml/changes in parameters... and so on. Don't get stressed, it shows some thousands of occurrences... will be fixed really soon. Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Step 2 implemented (both install & upgrade tested):

a) enums out from editor.
b) enums out from dbmanager
c) enums out from all upgrade scripts

TODO to complete this step:

a) erase enums from install.xml file. Trivial. Tomorrow.

Working on 3) Drop enum support from XMLDB / tests / Dictionary Moodle DB functions completely

a) fix tests (currently broken)
b) drop enums from sql_generators
c) add "1-click" fix to XMLDB Editor
d) test: install/upgrade/tests

Show
Eloy Lafuente (stronk7) added a comment - Step 2 implemented (both install & upgrade tested): a) enums out from editor. b) enums out from dbmanager c) enums out from all upgrade scripts TODO to complete this step: a) erase enums from install.xml file. Trivial. Tomorrow. Working on 3) Drop enum support from XMLDB / tests / Dictionary Moodle DB functions completely a) fix tests (currently broken) b) drop enums from sql_generators c) add "1-click" fix to XMLDB Editor d) test: install/upgrade/tests
Hide
Eloy Lafuente (stronk7) added a comment -

Step 3 partially done:

a) fix XMLDB tests, adding new ones for the drop_enum_from_field() new function.
b) fixed some minor problems in various drivers related to BLOB handling
c) dropped enums support from sql_generators (only the min. needed to implement drop_enum_from_field() remains.
d) marked all the sensible places with TODO: Drop in Moodle 2.1
e) tested install/upgrade/xmldb tests under all DBs. Working ok B)

TODO to complete the step:

a) fix dml/ddl tests (currently broken)
b) check them
c) add "1-click" fix to XMLDB Editor

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Step 3 partially done: a) fix XMLDB tests, adding new ones for the drop_enum_from_field() new function. b) fixed some minor problems in various drivers related to BLOB handling c) dropped enums support from sql_generators (only the min. needed to implement drop_enum_from_field() remains. d) marked all the sensible places with TODO: Drop in Moodle 2.1 e) tested install/upgrade/xmldb tests under all DBs. Working ok B) TODO to complete the step: a) fix dml/ddl tests (currently broken) b) check them c) add "1-click" fix to XMLDB Editor Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Step 3 considered done:

  • dml/ddl tests are fixed, some of them are failing but all them are going to be reviewed by MDL-19057 this week.
  • xmldb editor 1-click fix not implemented yet but addressed in MDL-19058 this week too

Tomorrow, step 4, documenting changes in Docs and so on (plus improvements to the checker).

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Step 3 considered done:
  • dml/ddl tests are fixed, some of them are failing but all them are going to be reviewed by MDL-19057 this week.
  • xmldb editor 1-click fix not implemented yet but addressed in MDL-19058 this week too
Tomorrow, step 4, documenting changes in Docs and so on (plus improvements to the checker). Ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Docs already updated to explain the ENUMs change with coding example and so on. Resolving this as fixed. Ciao, enums

Show
Eloy Lafuente (stronk7) added a comment - Docs already updated to explain the ENUMs change with coding example and so on. Resolving this as fixed. Ciao, enums

People

Dates

  • Created:
    Updated:
    Resolved: