Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
301
Merge Requests
301
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
e2d58353
Commit
e2d58353
authored
Sep 10, 2009
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#569240
by quicksketch: Remove field ID from field table names.
parent
7f88540b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
modules/field/modules/field_sql_storage/field_sql_storage.module
.../field/modules/field_sql_storage/field_sql_storage.module
+15
-3
No files found.
modules/field/modules/field_sql_storage/field_sql_storage.module
View file @
e2d58353
...
...
@@ -26,7 +26,7 @@ function field_sql_storage_help($path, $arg) {
* A string containing the generated name for the database table
*/
function
_field_sql_storage_tablename
(
$field
)
{
return
"field_data_
{
$field
[
'field_name'
]
}
_
{
$field
[
'id'
]
}
"
;
return
"field_data_
{
$field
[
'field_name'
]
}
"
.
(
$field
[
'deleted'
]
?
"_
{
$field
[
'id'
]
}
"
:
''
)
;
}
/**
...
...
@@ -38,7 +38,7 @@ function _field_sql_storage_tablename($field) {
* A string containing the generated name for the database table
*/
function
_field_sql_storage_revision_tablename
(
$field
)
{
return
"field_revision_
{
$field
[
'field_name'
]
}
_
{
$field
[
'id'
]
}
"
;
return
"field_revision_
{
$field
[
'field_name'
]
}
"
.
(
$field
[
'deleted'
]
?
"_
{
$field
[
'id'
]
}
"
:
''
)
;
}
/**
...
...
@@ -207,12 +207,24 @@ function field_sql_storage_field_storage_create_field($field) {
* Implement hook_field_storage_delete_field().
*/
function
field_sql_storage_field_storage_delete_field
(
$field_name
)
{
// Mark all data associated with the field for deletion.
$field
=
field_info_field
(
$field_name
);
// Mark all data associated with the field for deletion.
$field
[
'deleted'
]
=
0
;
$table
=
_field_sql_storage_tablename
(
$field
);
$revision_table
=
_field_sql_storage_revision_tablename
(
$field
);
db_update
(
$table
)
->
fields
(
array
(
'deleted'
=>
1
))
->
execute
();
// Move the table to a unique name while the table contents are being deleted.
$ret
=
array
();
$field
[
'deleted'
]
=
1
;
$new_table
=
_field_sql_storage_tablename
(
$field
);
$revision_new_table
=
_field_sql_storage_revision_tablename
(
$field
);
db_rename_table
(
$ret
,
$table
,
$new_table
);
db_rename_table
(
$ret
,
$revision_table
,
$revision_new_table
);
drupal_get_schema
(
NULL
,
TRUE
);
}
/**
...
...
Write
Preview
Markdown
is supported
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