Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
link
Commits
6b9a404f
Commit
6b9a404f
authored
Apr 20, 2009
by
John C Fiala
Browse files
bug report #318277 by quicksketch, recidive: set fields created by drupal 5 to nullable.
parent
c2d16275
Changes
1
Hide whitespace changes
Inline
Side-by-side
link.install
View file @
6b9a404f
...
...
@@ -49,3 +49,35 @@ function link_update_6000() {
}
return
array
();
}
/**
* Change the database schema to allow NULL values.
*/
function
link_update_6001
()
{
$ret
=
array
();
// Build a list of fields that need updating.
$update_fields
=
array
();
foreach
(
content_types_install
()
as
$type_name
=>
$fields
)
{
foreach
(
$fields
as
$field
)
{
if
(
$field
[
'type'
]
==
'link'
)
{
// We only process a given field once.
$update_fields
[
$field
[
'field_name'
]]
=
$field
;
}
}
}
// Update each field's storage to match the current definition.
foreach
(
$update_fields
as
$field
)
{
$db_info
=
content_database_info
(
$field
);
foreach
(
$db_info
[
'columns'
]
as
$column
)
{
db_change_field
(
$ret
,
$db_info
[
'table'
],
$column
[
'column'
],
$column
[
'column'
],
$column
);
$ret
[]
=
update_sql
(
"UPDATE {"
.
$db_info
[
'table'
]
.
"} SET "
.
$column
[
'column'
]
.
" = NULL WHERE "
.
$column
[
'column'
]
.
" = '' OR "
.
$column
[
'column'
]
.
" = 'N;'"
);
}
}
// Let CCK re-associate link fields with Link module and activate the fields.
content_associate_fields
(
'link'
);
return
$ret
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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