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:

  1. Find any usages. If there are none, mark that function as done in the list.
  2. If there are any sub-issues that are not RTBC, review them before proceeding to the next step.
  3. 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.
  4. Open follow-up issues to inject dependencies as appropriate.

Remaining issues that need to be solved before closing this meta:

Optional

Done:

Remaining tasks

User interface changes

API changes

Data model changes

Comments

cilefen created an issue. See original summary.

cilefen’s picture

Issue summary: View changes
gaurav.kapoor’s picture

Issue summary: View changes
gaurav.kapoor’s picture

Issue summary: View changes
gaurav.kapoor’s picture

Issue summary: View changes
gaurav.kapoor’s picture

Issue summary: View changes
gaurav.kapoor’s picture

Issue summary: View changes
cilefen’s picture

Issue summary: View changes
gaurav.kapoor’s picture

Issue summary: View changes
sidharthap’s picture

Issue summary: View changes
sidharthap’s picture

Issue summary: View changes
opensense’s picture

Issue summary: View changes
opensense’s picture

Issue summary: View changes
opensense’s picture

Issue summary: View changes
pritam-osl’s picture

Issue summary: View changes
cilefen’s picture

Everyone, let's please slow down on creating new issues and get the existing ones reviewed. Everyone go review someone else's please.

cilefen’s picture

Issue summary: View changes
jaykandari’s picture

Issue summary: View changes
jaykandari’s picture

Issue summary: View changes
jaykandari’s picture

Issue summary: View changes

moving db_truncate() to 2nd list, it is defined and only used in test files.

jaykandari’s picture

Issue summary: View changes
jaykandari’s picture

Issue summary: View changes

Moving following functions to 2nd list, as they don't have call implementation other than test files.

  • db_xor
  • db_escape_field
  • db_escape_table
  • db_query_temporary
  • db_driver
  • db_field_exists
  • db_index_exists
  • db_field_names
gaurav.kapoor’s picture

Issue summary: View changes
cilefen’s picture

Note 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).

gaurav.kapoor’s picture

Issue summary: View changes
gaurav.kapoor’s picture

Issue summary: View changes
gaurav.kapoor’s picture

Issue summary: View changes
dhruveshdtripathi’s picture

Issue summary: View changes
xjm’s picture

I 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?

cilefen’s picture

Yes. Otherwise this is going to be too difficult.

cilefen’s picture

This is a duplicate issue.

cilefen’s picture

Issue summary: View changes
cilefen’s picture

Issue summary: View changes
jeetendrakumar’s picture

Issue summary: View changes
jeetendrakumar’s picture

Issue summary: View changes
adriancid’s picture

Issue summary: View changes

Added the db_query issue.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

subson’s picture

If db_truncate is used in module, how can we replace that?

voleger’s picture

https://api.drupal.org/api/drupal/core%21includes%21database.inc/functio...

function db_truncate($table, array $options = []) {
  if (empty($options['target']) || $options['target'] == 'replica') {
    $options['target'] = 'default';
  }
  return Database::getConnection($options['target'])
    ->truncate($table, $options);
}

So, usage would be looks like:

\Drupal::database()->truncate($table);
$this->connection->truncate($table);
voleger’s picture

mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes

For db_field_set_default and db_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.

mondrake’s picture

Component: base system » database system
Issue summary: View changes
mondrake’s picture

Issue summary: View changes

The issues here led to removing usage, but not to deprecation according to new standard, so we will need new issues to fix them.

mondrake’s picture

Issue summary: View changes
andypost’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

andypost’s picture

mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
andypost’s picture

mondrake’s picture

Issue summary: View changes
voleger’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
voleger’s picture

andypost’s picture

Issue summary: View changes
voleger’s picture

voleger’s picture

voleger’s picture

mondrake’s picture

Issue summary: View changes
voleger’s picture

voleger’s picture

Issue summary: View changes
mondrake’s picture

voleger’s picture

mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

voleger’s picture

Issue summary: View changes

All calls were replaced

voleger’s picture

Issue summary: View changes

Reprioritized the issues. The real blocker for this meta is the issue #2947946: Create change record for all deprecated db_* functions

voleger’s picture

Issue summary: View changes

The last required issue is resolved, so all calls to functions from database.inc file was replaced and properly deprecated.
Set status to Needs review to collect more opinions and potentially resolve this issue as Fixed.

voleger’s picture

Status: Active » Needs review
voleger’s picture

Issue summary: View changes
Status: Needs review » Active
voleger’s picture

Issue summary: View changes
Status: Active » Needs review
andypost’s picture

This meta could be closed cos only 2 issues left but they are just related

voleger’s picture

Status: Needs review » Fixed

Agree. Mark as fixed.
Only #2849745: Replace documentation recommending db_*() wrappers left to completely deprecate database.inc file.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.