Problem/Motivation
#1894396: Mark db_*() wrappers in database.inc as @deprecated for 9.x deprecated the db_* family of functions. Let's remove all usages in core.
Proposed resolution
For each function below:
- Find any usages. If there are none, mark that function as done in the list.
- If there are any sub-issues that are not RTBC, review them before proceeding to the next step.
- Open an issue (Category: Task, priority: Normal, make this issue the parent issue) to replace all usages of the function (except tests for the function itself) and link the issue below.
- Open follow-up issues to inject dependencies as appropriate.
Remaining issues that need to be solved before closing this meta:
Optional
- #3014948: [META] Replace all direct db calls to entity tables with Entity API
- #2999962: Unify Database/Log::findCaller and Utility/Error::getLastCaller
- #2991337: Document the recommended ways to obtain the database connection object
Done:
- #2953385: Add a $connection property to DatabaseTestBase kernel test class to be used by extending classes
- #2991542: Introduce a DatabaseLegacyTest class for deprecation testing
- #3001216: Use the database.replica service where appropriate
- #3000931: Connection::query() does not support 'target' option
- #3049380: Complete deprecation of _db_get_target() function
- #2947946: Create change record for all deprecated db_* functions
- db_add_field #2993577: Properly deprecate db_add_field, db_drop_field, db_field_names
- db_add_index #2999586: Properly deprecate db_add_index
- db_add_primary_key #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_add_unique_key #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_and #2994556: Properly deprecate db_and, db_condition, db_or, db_xor
- db_change_field #2820179: Replace usages of deprecated method db_change_field()
- db_close #2848821: Replace all calls to db_close, which is deprecated
- db_condition #2994556: Properly deprecate db_and, db_condition, db_or, db_xor
- db_create_table #2994561: Properly deprecate db_create_table
- db_delete #2850033: Replace all calls to db_delete, which is deprecated
- db_driver #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_drop_field #2993577: Properly deprecate db_add_field, db_drop_field, db_field_names
- db_drop_index #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_drop_primary_key #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_drop_table #2848479: Replace all calls to db_drop_table, which is deprecated.
- db_drop_unique_key #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_escape_field #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_escape_table #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_field_exists #2999678: Properly deprecate db_field_exists
- db_field_names #2993577: Properly deprecate db_add_field, db_drop_field, db_field_names
- db_field_set_default #2993663: Deprecate Schema::fieldSetDefault and Schema::fieldSetNoDefault, they're not used
- db_field_set_no_default #2993663: Deprecate Schema::fieldSetDefault and Schema::fieldSetNoDefault, they're not used
- db_find_tables #2848808: Replace all calls to db_find_tables, which is deprecated.
- db_ignore_replica #2286235: Deprecate db_ignore_replica() and convert it to service
- db_index_exists #2999588: Properly deprecate db_index_exists
- db_insert #2853118: Replace all calls to db_insert, which is deprecated
- db_like #2850037: Replace all calls to db_like(), which is deprecated
- db_merge #2848952: Replace all calls to db_merge(), which is deprecated
- db_next_id #2848815: Replace all calls to db_next_id, which is deprecated
- db_or #2994556: Properly deprecate db_and, db_condition, db_or, db_xor
- db_query #2875394: Replace all calls to db_query, which is deprecated
- db_query_range #2999612: Properly deprecate db_query_range
- db_query_temporary #2996441: Replace all calls to db_query_temporary, which is deprecated.
- db_rename_table #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
- db_select #2873684: Replace all calls to db_select, which is deprecated
- db_set_active #2848812: Replace all calls to db_set_active, which is deprecated.
- db_table_exists #2848817: Replace all calls to db_table_exists, which is deprecated.
- db_transaction #2848820: Replace all calls to db_transaction, which is deprecated
- db_truncate #2996432: Replace all calls to db_truncate, which is deprecated.
- db_update #2848137: Replace all calls to db_update, which is deprecated
- db_xor #2994556: Properly deprecate db_and, db_condition, db_or, db_xor
Comments
Comment #2
cilefen commentedComment #3
gaurav.kapoor commentedComment #4
gaurav.kapoor commentedComment #5
gaurav.kapoor commentedComment #6
gaurav.kapoor commentedComment #7
gaurav.kapoor commentedComment #8
cilefen commentedComment #9
gaurav.kapoor commentedComment #10
sidharthapComment #11
sidharthapComment #12
opensense commentedComment #13
opensense commentedComment #14
opensense commentedComment #15
pritam-osl commentedComment #16
cilefen commentedEveryone, let's please slow down on creating new issues and get the existing ones reviewed. Everyone go review someone else's please.
Comment #17
cilefen commentedComment #18
jaykandariComment #19
jaykandariComment #20
jaykandarimoving
db_truncate()to 2nd list, it is defined and only used in test files.Comment #21
jaykandariComment #22
jaykandariMoving following functions to 2nd list, as they don't have call implementation other than test files.
Comment #23
gaurav.kapoor commentedComment #24
cilefen commented#2849745: Replace documentation recommending db_*() wrappers
Comment #25
cilefen commentedNote comment #22 needs another look because there are test usages for other things that call some of those functions. I think the way we want to go right now is to replace most usages except for tests of the thing itself (if there are any).
Comment #26
gaurav.kapoor commentedComment #27
gaurav.kapoor commentedComment #28
gaurav.kapoor commentedComment #29
dhruveshdtripathi commentedComment #30
xjmI think we should make the first issues about replacing code references, and then have a different combined followup for replacing all the documentation references for the different functions since they are often mentioned together. What do you think?
Comment #31
cilefen commentedYes. Otherwise this is going to be too difficult.
Comment #32
cilefen commentedThis is a duplicate issue.
Comment #33
cilefen commentedComment #34
cilefen commentedComment #35
cilefen commentedComment #36
jeetendrakumar commentedComment #37
jeetendrakumar commentedComment #38
adriancidAdded the db_query issue.
Comment #41
mondrakeSee #2953385: Add a $connection property to DatabaseTestBase kernel test class to be used by extending classes for a change to
DatabaseTestBase.Comment #43
subson commentedIf db_truncate is used in module, how can we replace that?
Comment #44
volegerhttps://api.drupal.org/api/drupal/core%21includes%21database.inc/functio...
So, usage would be looks like:
Comment #45
volegerComment #46
mondrakeComment #47
mondrakeFor
db_field_set_defaultanddb_field_set_no_default, I suggest to discuss in #2993663: Deprecate Schema::fieldSetDefault and Schema::fieldSetNoDefault, they're not used whether not just those, but even the new OOP methods should be deprecated.Comment #48
mondrakeComment #49
mondrakeThe issues here led to removing usage, but not to deprecation according to new standard, so we will need new issues to fix them.
Comment #50
mondrakeComment #51
andypostAdded related to
db_ignore_replica#2286235: Deprecate db_ignore_replica() and convert it to serviceComment #52
mondrakeComment #53
mondrakeComment #54
mondrakeOpened #2994556: Properly deprecate db_and, db_condition, db_or, db_xor.
Comment #55
andypostfiled #2994561: Properly deprecate db_create_table
Comment #56
mondrakeComment #57
mondrakeComment #58
mondrakeOpened #2994694: Properly deprecate db_driver, db_escape_field, db_escape_table, db_rename_table, db_drop_index, db_drop_unique_key, db_add_unique_key, db_drop_primary_key, db_add_primary_key
Comment #59
mondrakeComment #60
mondrakeOpened #2994904: Convert query('SELECT ... FROM {xxx}') to select('xxx')->... in tests that would help reducing later efforts on #2875394: Replace all calls to db_query, which is deprecated
Comment #61
mondrakeComment #62
mondrakeComment #63
mondrakeComment #64
andypostFiled
- #2996436: Follow-up to fix DatabaseLegacyTest::testDbRenameTable
- #2996432: Replace all calls to db_truncate, which is deprecated.
Comment #65
andypostFiled #2996441: Replace all calls to db_query_temporary, which is deprecated.
Comment #66
mondrakeComment #67
volegerComment #68
mondrakeComment #69
mondrakeOpened
Comment #70
mondrakeComment #71
mondrakeComment #72
volegerCreated #2999612: Properly deprecate db_query_range
Comment #73
andypostFiled patch for last one #2999678: Properly deprecate db_field_exists
Comment #74
volegerFixed #2999612: Properly deprecate db_query_range
Comment #75
volegerFixed #2999588: Properly deprecate db_index_exists
Comment #76
volegerFixed #2999678: Properly deprecate db_field_exists
Comment #77
mondrakeAdding to IS some more issues that IMHO should be solved before closing this meta.
Comment #78
mondrakeComment #79
volegerFixed #2850037: Replace all calls to db_like(), which is deprecated
Comment #80
volegerComment #81
mondrakeComment #82
voleger#3001216: Use the database.replica service where appropriate
Comment #83
mondrakeComment #84
mondrakeComment #85
mondrakeComment #86
mondrakeComment #87
mondrakeComment #88
mondrakeComment #89
mondrakeComment #90
voleger#2959269: [meta] Core should not trigger deprecated code except in tests and during updates
Comment #92
volegerAll calls were replaced
Comment #93
volegerReprioritized the issues. The real blocker for this meta is the issue #2947946: Create change record for all deprecated db_* functions
Comment #94
volegerThe last required issue is resolved, so all calls to functions from database.inc file was replaced and properly deprecated.
Set status to
Needs reviewto collect more opinions and potentially resolve this issue asFixed.Comment #95
volegerComment #96
volegerMy mistake. Closed #3049380: Complete deprecation of _db_get_target() function issue. So we still need to resolve #2947946: Create change record for all deprecated db_* functions
Comment #97
voleger#2947946: Create change record for all deprecated db_* functions fixed.
Comment #98
andypostThis meta could be closed cos only 2 issues left but they are just related
Comment #99
volegerAgree. Mark as fixed.
Only #2849745: Replace documentation recommending db_*() wrappers left to completely deprecate database.inc file.