Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
124362f4
Commit
124362f4
authored
Nov 23, 2007
by
Nigel McNie
Browse files
More fixes to the upgrade process so that MySQL users can upgrade.
XMLDB and MySQL conspired to make this a horrible process.
parent
a88813e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/db/upgrade.php
View file @
124362f4
...
...
@@ -334,8 +334,14 @@ function xmldb_core_upgrade($oldversion=0) {
// given that the table needs to be used by block instances being
// created, make the fields nullable during that time.
// Note - XMLDB - you are a whore. Hate, Nigel
execute_sql
(
'ALTER TABLE {view_artefact} ALTER ctime DROP NOT NULL'
);
execute_sql
(
'ALTER TABLE {view_artefact} ALTER format DROP NOT NULL'
);
if
(
is_postgres
())
{
execute_sql
(
'ALTER TABLE {view_artefact} ALTER ctime DROP NOT NULL'
);
execute_sql
(
'ALTER TABLE {view_artefact} ALTER format DROP NOT NULL'
);
}
else
{
execute_sql
(
'ALTER TABLE {view_artefact} CHANGE ctime ctime DATETIME'
);
execute_sql
(
'ALTER TABLE {view_artefact} CHANGE format format TEXT'
);
}
// Install all the blocktypes and their categories now, as they'll be
// needed for the template migration
...
...
@@ -358,13 +364,24 @@ function xmldb_core_upgrade($oldversion=0) {
upgrade_template_migration
();
delete_records_select
(
'view_artefact'
,
'block IS NULL'
);
execute_sql
(
'ALTER TABLE {view_artefact} ALTER block SET NOT NULL'
);
if
(
is_postgres
())
{
execute_sql
(
'ALTER TABLE {view_artefact} ALTER block SET NOT NULL'
);
}
else
{
execute_sql
(
'ALTER TABLE {view_artefact} CHANGE block block BIGINT(10) UNSIGNED NOT NULL'
);
}
$table
=
new
XMLDBTable
(
'view_artefact'
);
$field
=
new
XMLDBField
(
'oldblock'
);
drop_field
(
$table
,
$field
);
$table
=
new
XMLDBTable
(
'view'
);
// Especially for MySQL cos it's "advanced"
$key
=
new
XMLDBKey
(
'templatefk'
);
$key
->
setAttributes
(
XMLDB_KEY_FOREIGN
,
array
(
'template'
),
'template'
,
array
(
'name'
));
drop_key
(
$table
,
$key
);
$field
=
new
XMLDBField
(
'template'
);
drop_field
(
$table
,
$field
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment