Questions tagged [database]

Drupal provides a standard, vendor-agnostic abstraction layer for accessing database servers.

Filter by
Sorted by
Tagged with
0 votes
1 answer
14 views

Column not found: 1054 Unknown column after creating new field

Background I attempted to add a new field "Audience" which is an entity reference field referencing an "Audience" taxonomy. After creating this, I attempted to edit it to allow the ...
GeorgeCiesinski's user avatar
0 votes
0 answers
26 views

How can I switch between databases in a multisite environment using the entity API?

I'm working in a multisite environment and need to switch between databases based on certain conditions. I successfully switched the active database connection using Database::setActiveConnection() in ...
Marwen Amri's user avatar
-1 votes
0 answers
47 views

The requirements say "MariaDB 5.1.44 or higher". Is MariaDB 10.3.7 supported?

According to the information available, Drupal 7 supports MariaDB version 5.1.44 or higher. Does that include MariaDB version 10.3.7 or any higher version?
Ιωάννης Κοσμάς's user avatar
-2 votes
0 answers
27 views

Compatibility of Bioinformatics modules: Should I downgrade for the unsupported modules?

As part of college course work, I am required to make a genomic database for a local website with basic features (like gene search, sequence alignment). I have installed Drupal 10.2.3 with PostgreSQL ...
s-135's user avatar
  • 5
-1 votes
1 answer
21 views

Error with Chado module installation

As part of college course work, I am required to make a genomic database with a local website with basic features. I have installed Drupal 10.2.3 with PostgreSQL 14.11, PHP 8.3.4 and Tripal 4.0.0-...
s-135's user avatar
  • 5
0 votes
0 answers
31 views

Composer installing Tripal module only above v4 and if continuing with v4, getting error with Chado module [closed]

As part of college course work, I am required to make a genomic database with a local website with basic features. I have installed Drupal 10.2.3 with PostgreSQL 14.11 and PHP 8.3.4. My primary ...
s-135's user avatar
  • 5
3 votes
1 answer
52 views

How to delete duplicate path aliases?

Duplicate path aliases are seen as rows in the path_alias table with identical path and alias columns. Due to old bugs in pathauto and other reasons, like buggy custom code, it is possible to have ...
cilefen's user avatar
  • 5,967
0 votes
0 answers
50 views

How to speed up View render time in Drupal Views?

I have pretty big View which returns hundreds of rows and I am struggling with View render time. Stats are as follow: Query build time: 44.69 ms Query execution time: 111.52 ms View render time: 6978....
Lub's user avatar
  • 61
-2 votes
1 answer
36 views

Why is the db connection to migrate silently failing?

I'm using D10, drush 12, ddev. In settings.local.php I have: $databases['migrate']['default'] = array ( 'database' => 'd7', 'username' => 'db', 'password' => 'db', 'host' =>...
JAyenGreen's user avatar
-3 votes
2 answers
33 views

database query's columnCount() and getColumnMeta() missing from core

In Drupal 9 I could do: $result = \Drupal::database()->query($query, $args); then call $result->columnCount() also $recs->getColumnMeta($c) In Drupal 10 these functions: columnCount() and ...
Jons's user avatar
  • 1
0 votes
1 answer
18 views

Is the DRUPAL_DATABASE_HOST value stored somewhere in the database?

I want to see what the value is for the database host, the value that you enter when installing for the first time. Is there a way to see and edit this value after installation? Is it stored in a ...
jfc's user avatar
  • 195
0 votes
0 answers
37 views

How to establish a database connection to Microsoft SQL server that has more than one server instance?

For an MSSQL database at the IP 192.168.55.55 and a server name of MYDB2, what should my database settings be in the settings.php file? (Please note, the machine has more than one database server, so ...
arnoldbird's user avatar
  • 1,193
0 votes
1 answer
130 views

Update database issue

In 2 of my 3 Drupal websites, drush updb crashes with the following error after upgrading from Drupal 9.5.11 to Drupal 10.2.2. In BatchStorage.php line 143: [Exception] Serialization of 'Closure' ...
Pierre Ernould's user avatar
0 votes
1 answer
33 views

REGEX_REPLACE error when running DB query from update hook

This MySQL statement runs fine on MySQL 8.0.33-0ubuntu0.20.04.2: mysql> UPDATE node__body SET body_value = REGEXP_REPLACE(body_value, "<img.*base64.*>", ""); Query OK, 0 ...
pmagunia's user avatar
  • 697
0 votes
1 answer
91 views

How to let users write private letters to me about a node?

I want to let users the ability to write personal letters to me based on nodes they read while letters are stored in the Drupal database itself (no emails involved) and will include these fields: ...
alesios's user avatar
  • 41
0 votes
0 answers
23 views

Kernel and functional testing with an MSSQL database

I am new to testing custom modules. My custom modules create and update custom nodes. From my reading, I need to use Kernel or Functional tests to test these operations. My Drupal 9 installation is ...
spacecraft96's user avatar
0 votes
2 answers
41 views

How can I get the record of the last insert?

Is there a method to be called that will get the ID of the record just inserted? In my module the first thing done is the insert of some data into a table. After that I have other things to do in the ...
Cy Jobes's user avatar
1 vote
0 answers
87 views

PDOStatement::execute(): SSL: Broken pipe [closed]

I have a Drupal 9.5.11 site running well on a single EC2 instance and a remote MySQL server (RDS). I am trying to replicate a very similar scenario with a single EC2 instance but I am using AWS ...
Josh's user avatar
  • 195
0 votes
0 answers
40 views

Unable to add Menu Items due to IntegrityConstraintViolationException

Background I recently encountered an error when I try to create a new menu item: Drupal\Core\Entity\EntityStorageException: SQLSTATE[HY000]: General error: 1364 Field 'parent' doesn't have a default ...
GeorgeCiesinski's user avatar
0 votes
1 answer
114 views

How to join the node table with the url_alias table in a dynamic query?

Joining the node table to the url_alias table requires CONCAT. Here is an example of how this can be done: $results = $db->query(" SELECT n.nid, n.title, a.source, a.alias FROM ...
arnoldbird's user avatar
  • 1,193
0 votes
1 answer
36 views

How do I sort view results by query order?

In my twig I use {{ drupal_view('slider', 'block_1', '74,84,82' ) }}, how can I make sure the output of this view has the slides in that specific order? Currently on D9. I've looked around but can't ...
Lenny's user avatar
  • 214
3 votes
1 answer
99 views

Drupal::entityQuery add CASE to have NULL values displayed last

I want to sort some entities in ascending expiration date, but I want those without expiration date to be at the end. Is there a way to add a CASE expression like this to the Drupal::entityQuery? $...
user7167081's user avatar
1 vote
2 answers
100 views

Finding all nodes not referenced by a menu

I see this question was asked for Drupal 7, but the menu_link table doesn't exist in Drupal 9. Is there a SQL query for listing all nodes that are not assigned to a menu?
C0c0b33f's user avatar
0 votes
1 answer
442 views

Multiple primary key defined When importing DB to Dev

I'm trying to update my D9 dev site database using my production database, but it keeps erroring out when it reaches to ALTER table section in the database. This is the ERROR 1068 (42000) at line ...
MetalBearSolid's user avatar
0 votes
0 answers
55 views

How do I switch from PostgreSQL to MySQL

I set up a website using Drupal 10 and PostgreSQL but due to a communication delay, I just found out from the server team that the database on the staging/live servers is MySQL and not PostgreSQL. I ...
GeorgeCiesinski's user avatar
0 votes
0 answers
22 views

MSSQL - How to get a list of documents from a node that is using a space and a view?

I have a list of documents that are associated with a node of type space. The space has a page with a view and filter to list documents only related to that node. I'm trying to query the database to ...
Charlie Boy's user avatar
2 votes
1 answer
99 views

Paragraph Entity Query returns too many results

I'm trying to find a paragraph that have a certain taxonomy term value and on a matching parent node. I tried the code below, but it always returns over 30 values, when really only one paragraph ...
Rene's user avatar
  • 111
0 votes
0 answers
31 views

How to change the default database driver to the SQLite option in profile installation?

I have two database driver options in the "database setup" step while installing a Drupal project from a custom profile. By default, the MySQL database is selected. But I want it to choose ...
Tasneem's user avatar
  • 95
-1 votes
1 answer
95 views

Using common database for multiple developers in local environment gets slow

When use the common database to develop in local environment for multiple developers in one Drupal 9 project is getting too slow. This issue occurs on Drupal sites only, others (Wordpress, Laravel, ...
Sukanya Sathyan's user avatar
1 vote
1 answer
408 views

Can I use entityQuery() in a Drupal 10 site to query entities from a Drupal 7 database?

Can I use entityQuery() to query entities in a Drupal 7 table? I know it's possible to change the active database and then use a dynamic query to access the database, but can I do that also with ...
arnoldbird's user avatar
  • 1,193
0 votes
1 answer
81 views

Condition that deletes rows older than 30 days

How can I query a condition that deletes the rows with column Date older than the last 30 days in DBTNG format? I have tried this, but it's wrong. $connection = \Drupal::database(); $connection->...
Ricardo Castañeda's user avatar
0 votes
1 answer
32 views

DBTNG sentence that sums a column from all rows of a specific user and dpm the total

This is my table test_sum_expression with columns: uid (int) Stores the UID of the user. points (int) Stores a number. I have this SQL sentence which SUMS all points from user with uid 1. SELECT uid, ...
Ricardo Castañeda's user avatar
0 votes
1 answer
140 views

Database addExpression SUM: Call to a member function execute() on string

I need to get the sum of all points values of the user with uid 1 from the test_sum_expression table. But when I try to execute I get this message Error: Call to a member function execute() on string....
Ricardo Castañeda's user avatar
5 votes
0 answers
57 views

Prioritise condition in QueryInterface

I have an overview with a search field. The query should search on both the title and description, but I would want to show my results that have the search parameter in the title first in the list. I ...
Cedric Lenders's user avatar
-2 votes
3 answers
112 views

Get the HTML content from the database [closed]

I have a copy of a Drupal 9 database from which I need to download all the pages. I loaded the database in MySQL Workbench CE and connected to it via Python. There are many tables, but no views or ...
user21365078's user avatar
0 votes
1 answer
306 views

The specified database connection is not defined: default for Drupal drush

I have the following configurations for my Drupal site: sites/mysite/settings.local.php $databases['default']['default'] = array( 'database' => 'mydb', 'username' => 'root', 'password' =&...
Happy Coder's user avatar
1 vote
1 answer
141 views

Schema insert row only if primary key doesn't exist

I'm doing an exercise where I have a table called visit_counter with fields uid (primary key that stores the user id) and user_visit_count (sum of user's page visits). The purpose of the table is to ...
Ricardo Castañeda's user avatar
0 votes
1 answer
50 views

How to delete a no longer used custom bin table?

I'm testing the cacheAPI with a custom bin. Everything is working. On the other hand, while testing, I created a custom bin with a name that does not suit me. cache.lorem_bin: class: Drupal\Core\...
Sébastien Gicquel's user avatar
0 votes
0 answers
26 views

Special sorting requirement in views for a multi-value field: how to avoid duplicated result items

This is another attempt to solve Custom views filter plugin: filter over two fields of a custom entity where one of the fields is a multi value field in a seperate table I have create a basefield (...
Tobias Krause's user avatar
1 vote
1 answer
81 views

While upgrading from D6, update.php appears to expect the Drupal 7 version of the database array and it throws errors

Leaving settings.php in place (but writeable), per instructions 13 + 14 of major upgrade section of https://api.drupal.org/api/drupal/UPGRADE.txt/7.x , with the new D7 codebase but the old D6 DB, i ...
john brush's user avatar
1 vote
2 answers
128 views

Custom views filter plugin: filter over two fields of a custom entity where one of the fields is a multi value field in a seperate table

I have a custom entity with two basefields of type "list_string": "role" and "additional_role". I need this as "role" is used for sorting the entities by a very ...
Tobias Krause's user avatar
-2 votes
1 answer
105 views

How can i subscribe/unsubscribe to a simplenews newsletter programmatically?

I have the following code to set subscriptions to a simplenews newsletter on or off: $user_load = User::load($userID_current); $newsletter_subscriptions = [ 'newsletter1' => 'on', ...
Tobi's user avatar
  • 23
1 vote
0 answers
49 views

How to add groupBy option WITH ROLLUP

With Drupal 9.5.3, a group by like this: $query->groupBy("myfieldname WITH ROLLUP"); will result in (...) Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not ...
MSNOP's user avatar
  • 11
1 vote
0 answers
29 views

How can I find all the nodes that use a hierarchical vocabulary taxonomy term and reference a child term but not its parent term

I am using Drupal 7. I have a content type "Public Resource" that uses a hierarchical vocabulary called "Resource Topics" that has up to 3 levels (parent->child->child of ...
Matt Pugh's user avatar
4 votes
0 answers
155 views

How can I dynamically switch between two databases for ALL queries?

I need to copy some entities from one Drupal 9 database to different Drupal 9 database. I have searched and looked high and low, but none of the examples I have found work anywhere. I found no help on ...
Martin Joergensen's user avatar
0 votes
1 answer
49 views

How do I enable all error messages altering directly a database table?

When I try to log in on a site, I get a generic error, which doesn't help in understanding what exactly is going wrong. I would like to enable the All messages, with backtrace information option shown ...
-1 votes
1 answer
2k views

Unable to connect to database when launching a new Drupal site with Lando [closed]

I tried to set up a new local drupal9 site using Lando, but it is unable to connect to the database and I am getting the following error. Failed to connect to your database server. The server reports ...
shibasaki_stack's user avatar
0 votes
1 answer
412 views

Database update doesn't work after update from 9.2 to 9.3

I have unfortunately not found anything that seems to solve my issue. My Google-fu may be defunct. I have upgraded a Drupal site from 9.2 to 9.3. This works as expected with composer (I use drupal/...
Angus's user avatar
  • 51
0 votes
1 answer
54 views

How can I delete properly an old translation string?

I found an old string into locales_source table, like that: The associated 8.5.3 version seems outdated. I would like to understand the usefulness of the keep this data in my database ? How to clean ...
florian_drupal's user avatar
1 vote
1 answer
253 views

Migrating from D7 / MySQL 5.6 to D9 / MySQL 8

I've read the documentation of upgrading (migrating) from D7 to D9, but didn't see anything about how to handle changing MySQL versions in the process. My D7 instance is on MySQL 5.6, which is ...
leducvin's user avatar

1
2 3 4 5
63