As of May 31, 2023, we have updated our Code of Conduct.

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
411 views

Search and Replace URL in database?

I need to move a Drupal 9 website to a different server and a lot of links have the old server URL. Normally for Word Press I use this tool - https://github.com/interconnectit/Search-Replace-DB https:/...
jfc's user avatar
  • 173
-1 votes
1 answer
119 views

Can't import sql dump file from the live site (trying to create a development site)

I am trying to create a development site which I can work on. So far, I have done: creating a backup.sql using drush sql-dump > backup.sql coping and pasting the live site folder for the ...
user888's user avatar
4 votes
0 answers
1k views

Schema information for module is missing - how to fix?

I tried to install the Scheduler module but it did not install properly because we somehow did not have code for another custom module that the database thinks was installed. I got the code for the ...
Stephen Ash's user avatar
1 vote
0 answers
79 views

Problems in collations when restoring

I'm quite lost with this issue I'm experiencing, so any clue will be appreciated. Let's start with the "symptoms". Whenever I restore a Drupal 7 site that has been previously backed up with ...
José L.'s user avatar
  • 245
1 vote
1 answer
607 views

Get raw SQL query from Drupal::entityTypeManager

How can I fetch the raw sql version of the following statement? $t = \Drupal::entityTypeManager() ->getStorage('taxonomy_term') ->loadByProperties(['name'...
meen's user avatar
  • 595
0 votes
0 answers
51 views

Altering user_admin_account and user_register_form

I'm pretty new to Drupal and I'm trying to build a Drupal 7 custom module to alter the user listings table in admin/people. I would like to display the first and last names of the users. I've already ...
cristina's user avatar
0 votes
0 answers
31 views

Restore menu items using database backup

When working on a site I accidentaly removed all my menu items I now want to recover them from a database back-up I have. Is it enough to just copy all data from these tables from the backup to my ...
Joost's user avatar
  • 1,078
0 votes
1 answer
144 views

Anonymous user redirected to core/install.php while admin does not

As an admin I've built a large table on Drupal 8 (php, mysql). It runs without issues for Admin, but trying as Anonymous user it redirects me to core/install.php Since it's ONLY affecting Anonymous ...
Sonya's user avatar
  • 17
1 vote
1 answer
423 views

List all the nodes with the same menu parent ID

I have the following menu in my system. The parent menu-link connects to a node whose ID is 58. All the sub menu-links have a parent ID equal to 58. I need to find the main and the sub-menus using 58,...
sisko's user avatar
  • 1,740
-3 votes
1 answer
165 views

How to get table names from external DB in non public schema

I am writing a configuration entity modul in drupal 9. I want to list all tables, from an external database (postgis) in the schema called gi. The switch between the databases is no problem. I'm ...
Steffen 's user avatar
0 votes
0 answers
46 views

Query the database for the value of a ckeditor field

So I want to QUERY the database for the contents of a field, the trouble is the field is a ckeditor field, so how do I write the condition correctly? Normally it would be something like this: $query = ...
RominRonin's user avatar
1 vote
1 answer
2k views

Can't restore existing site (no route found for "GET /")

I have a site with Drupal 9.2.5 and the site was clobbered after installing WordPress in the web root. I have a backup of the site database, and the sites/default/* files, but I just can't get Drupal ...
James Young's user avatar
0 votes
1 answer
38 views

Custom Migration Plugin MySQL Error

I've run into the following error when running the command drush migrate-import custom_spotlight where custom_spotlight is the name of the plugin. I've been following along with this guide: https://...
Sam Ng's user avatar
  • 1
1 vote
0 answers
68 views

For which tables should the MariaDB user have CRUD permissions for browsing the site?

I'm trying to lock down the database on my Drupal 9 install so that people can browse the website, but can't write to it. I have 2 users in MariaDB with access to the database. I want to set one ...
blur's user avatar
  • 57
1 vote
0 answers
40 views

entityQuery returns wrong result: too many joins?

I built an entityQuery for a custom entity type "vote". I only want to get those votes for a specific poll and those by deputies who are members of a specific fraction. The fraction ...
Tobias Krause's user avatar
0 votes
0 answers
434 views

Cannot access mysql in new docker/docksal/d9 installation

I had a D9 installation running in MacPorts. I installed docker and docksal, copied the D9 project to the docksal project folder, and uninstalled MacPorts. Docksal starts up like this: Starting ...
JAyenGreen's user avatar
2 votes
1 answer
60 views

Join with Like in Views Plugin

Attempting to do a join with a LIKE operand in a Views filter plugin. The query looks similar to below; however, when it executes, the LIKE operand is not taken into account and the join is done with ...
Wingman's user avatar
  • 31
0 votes
1 answer
329 views

Get path (alias) from SQL query

I have a SQL query to get all nodes with their ID, title, publish date, change date, etc. Additionally I need to get path to each of them (probably from path_alias.alias). Now I have following (...
mixerowsky's user avatar
  • 1,606
-1 votes
1 answer
499 views

How do I programmatically set a database connection?

Hello can anybody help with a external Database Connection. $postgis_database = array( 'database' => $drugis_postgis_connection->getdatabase(), 'username' => $...
Steffen 's user avatar
0 votes
1 answer
92 views

Optimize fetching data from entity objects [duplicate]

Currently we are using EntityTypeManager to either load or loadMultiple : $this->entityTypeManager->getStorage('node')->loadMultiple($nids); $this->entityTypeManager->getStorage('node')-...
Gabriel Fernandez's user avatar
-1 votes
1 answer
66 views

How do I add link to Edit and Delete in a column in a view table item list?

I've trying to add a link to Edit and Delete column to perform desirable actions. I need help in implementing it. I've tried several suggested methods on the internet, but none did the job for me. ...
Sourabh singh's user avatar
0 votes
0 answers
31 views

Content Translation installation breaks the website (statistics module error + aliases not taken into account)

First, I would like to say I am a total noob in Drupal and PHP but possess some knowledge on other web frameworks/languages). Here is my path to the errors: I used the UI to install Content ...
Dna's user avatar
  • 1
0 votes
1 answer
82 views

can you search database for page values

I have taken over a Drupal 7 site which used to be on a different server and has now moved to ours. I have discovered that on lots of Pages, there are images which point to the wrong server name, the ...
Helen Postle's user avatar
0 votes
0 answers
125 views

Multiple databases

I'm having trouble getting Drupal to switch between multiple databases. I have a system that involves connecting to an external database to retrieve data. I am using the following code inside of a ...
Ex0r's user avatar
  • 171
-1 votes
1 answer
722 views

Site broken with multiple errors

I am trying to install a Drupal site locally on a new laptop that was working fine on the old one. I get the following errors. Notice: Undefined offset: 2 in Drupal\Core\Database\Database::...
Derek Johnson's user avatar
1 vote
0 answers
64 views

When old field revisions should be deleted from the database?

I have a question about old fields revisions in Drupal 8. For example I have "Full Title" field in different paragraphs. I have deleted this field from one of the paragraphs, for example ...
Belial's user avatar
  • 161
0 votes
3 answers
247 views

Use read-only database user to minimize security risks

I want to phase out an old, unmaintained Drupal 6 page. The website should still stay online, but should be read-only. I want to change the database user so that it only has read privileges. I don't ...
Harold L. Brown's user avatar
0 votes
0 answers
128 views

update a entity with presave method to avoir a loop

In the hook_entity_update function update_candidat_from_contrat_direct(Drupal\Core\Entity\EntityInterface $entity) I call another function in which : I create a new node $new_entity = \Drupal::...
cocq's user avatar
  • 45
10 votes
1 answer
955 views

What is the significance of dumping the tablespaces?

While recently running drush sql-dump on a server where there were never any error messages, I have started to get: mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(...
siliconmeadow's user avatar
1 vote
1 answer
114 views

Is there a database lock mechanism?

I have a parent child entity relationship which is driven by a REST API. The payload contains data for both the parent and the child. The parent can have many children. When the (child) payload is ...
liquidcms's user avatar
  • 1,135
2 votes
1 answer
354 views

Check if the connection to the database is available

I have 2 databases, the first one with Drupal and the second one with external data. In a controller I want to read data from that second database and display it. As the external database can be ...
Javier Rey's user avatar
1 vote
2 answers
574 views

Limit size of cachetags table

One of the site has fairly large cachetags table at over 418K records. Is there a way to limit the size of this table. This table is not cleared on cache clear. Since Drupal 8.4 there has been a way ...
amit's user avatar
  • 444
0 votes
1 answer
214 views

Dynamic query with left join

I need to collect comments that belong to certain user and submitted on pages of certain content type nodes. Currently I'm making two queries: $nodes = db_select('node', 'n') ->fields('...
user102362's user avatar
0 votes
0 answers
433 views

Failed to update database after upgrading to 8.9.13

I'm new to drupal and was recently tasked with upgrading the drupal core version of one of our sites. I upgraded from 8.3 to 8.9.13 and everything went smooth enough until it came time to update the ...
IeuanByers's user avatar
1 vote
0 answers
34 views

Double Publish is Required To Update Data When Node is Under High Traffic

We have a high-volume production site that is running into issues of serving stale data when a node is republished. Description/Example Of Issue I go into a node, create a new draft, then make some ...
sorebear's user avatar
-1 votes
2 answers
1k views

How do I join two tables?

I was following this tutorial on Drupal module development. It talks about database query joins in module development. The tutorial is made for Drupal 8 and I'm using Drupal 9. Then I made this (look ...
Natanael Osorio's user avatar
0 votes
2 answers
584 views

Converting a Views SQL query with INNER JOIN to an EntityQuery

I'm trying to create a custom JSON:API resource that returns the entities that have been flagged by a user. (The Flag module does not offer a way to get this out of the box.) I used Views to build a ...
Patrick Kenny's user avatar
1 vote
1 answer
318 views

Unable to get titles to show up as higher priority in search than content

I have a website I am working on that has a TON of content. The client has noticed that when searching for titles in the site search, it seems to prioritize the body content over the title. So I ...
Patrick's user avatar
  • 1,300
0 votes
0 answers
142 views

How to migrate PDF files to specific node

I have a directory with PDF files and I have 45 nodes of content type Download. I have to migrate each PDF file to specific node. All PDF file names I read from a CSV. Before these PDF files, I had to ...
ckojo's user avatar
  • 1
0 votes
0 answers
2k views

PDO database connection error?

Super strange, my site was up and working fine yesterday. Today, I navigate to my home page and I'm thrown this series of errors: Warning: PDO::__construct(): php_network_getaddresses: getaddrinfo ...
Brittany's user avatar
  • 239
1 vote
1 answer
109 views

EntityQuery PHP issue when assigning the query to a variable

I am very confused about this behavior of EntityQuery, or maybe I am just missing something basic about PHP. Here is the query I am working with: $entity_query_points1 = \Drupal::entityQuery($...
Patrick Kenny's user avatar
3 votes
0 answers
40 views

Speed up login after changing user name datastore type to VARBINARY from VARCHAR

We have a project underway that requires the import of ~6 million users into Drupal (Core 7x) that have many (150K+) case-insensitive duplicate usernames. Importing these users with existing case and ...
CMSW's user avatar
  • 31
0 votes
0 answers
267 views

Unbuffered query errors and conflict in access to the database

I've been developing on Drupal at work for some time, now I also have a hosted personal site (on fastcomet). The first install was with 8.6 and php 7.2, then it has been idle for a while, now I ...
Francesco Marchetti-Stasi's user avatar
0 votes
2 answers
495 views

fetchAll Database query returns an error

I'm building a REST Resource in drupal 8 php that returns the result of a query to the database. However using the fetchAssoc() only returns one result. So I figured that fetchAll() returns all ...
mak212's user avatar
  • 3
1 vote
1 answer
286 views

How do I get the number of rows affected from an update query?

I'm having trouble figuring out how to get the number of affected rows from an update query in Drupal. I have a form where users can update their profile details. Now, not every user is going to ...
Julio Sandoval's user avatar
1 vote
0 answers
85 views

Database password revealed in PHP error_log?

Noticed some errors while updating to Drupal 8.9.11. As I'm reviewing I come across the following. Replaced the actual password with PASSWORD below. Is this intentional or a bug? I can't see why the ...
Jeff's user avatar
  • 93
2 votes
1 answer
45 views

List all node titles to better iterate on a list of names

I have a content type called Country and I have to verify what countries already exists in db and save the missing ones, comparing to a variable with all countries ($country_list). I am having trouble ...
Fabíola's user avatar
0 votes
0 answers
80 views

How to display or make the cities selectable in address module?

I'd like to set for users on Drupal 9-Website on the registration form and for some content-types a new field "Address". I did activate module "address" and added new field to user ...
lexx's user avatar
  • 21
3 votes
2 answers
1k views

How can I query by node title?

In Drupal 7 I had this code to query node fields and its respective title: $query = db_select('node', 'n'); $query->join('field_data_field_internal_institute_paper_i', 'iipi', 'n.nid = iipi....
supersize's user avatar
  • 263
1 vote
1 answer
661 views

How to update Drupal custom module after changing .install file

I am working on a pre-created Drupal 8 project that has a custom module called CCA(named out of project title). I have done the below update in the .install file to add a new column to the backend via ...
Rick's user avatar
  • 125

1
2
3 4 5
62