Questions tagged [database]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
47 views

Load node entities by owner

I want to load entities by their owner. This is what I have so far: \Drupal::logger('migrate_users')->notice("Hello start"); $userStorage = \Drupal::entityTypeManager()->getStorage('...
0
votes
1answer
27 views

Where are URL aliases stored as of Drupal 8?

I am looking for where URL aliases are saved. I know in Drupal 7 it was the url_alias table, but in Drupal 8 I can't find it.
1
vote
1answer
25 views

Problem with database version for drupal 9 db upgrade

Hi I am trying to upgrade drupal 9 on godaddy and when I go to update.php I get this note on the screen... DATABASE SYSTEM VERSION 5.6.51-cll-lve The database server version 5.6.51-cll-lve is less ...
0
votes
1answer
68 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:/...
0
votes
1answer
28 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 ...
0
votes
0answers
78 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 ...
1
vote
0answers
24 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 ...
1
vote
1answer
56 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'...
0
votes
0answers
19 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 ...
0
votes
0answers
22 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 ...
0
votes
1answer
43 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 ...
0
votes
1answer
78 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,...
-3
votes
1answer
42 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 ...
0
votes
0answers
26 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 = ...
0
votes
0answers
43 views

Multiple unnecessary joins when creating an andConditionGroup()

I have a large array of names and surnames, I need to know which of these differ from the current ones in the database. For example: $largeList = largeList(); $storage = $this->...
1
vote
1answer
212 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 ...
0
votes
1answer
30 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://...
1
vote
0answers
49 views

Securing the DB: What 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. Say I have 2 users in MariaDB with access to the database: public private I ...
1
vote
0answers
37 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 ...
0
votes
0answers
36 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 ...
2
votes
1answer
31 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 ...
0
votes
1answer
76 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 (...
0
votes
0answers
16 views

Managed file element in custom field module doesn't save target id

I have been breaking my head on this issue for a few days now. Using Drupal 9.2.x, I am building a custom field module for a client that has multiple fields. I isolated the problem by only including a ...
-1
votes
1answer
81 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' => $...
0
votes
1answer
43 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')-...
-1
votes
1answer
20 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. ...
0
votes
0answers
15 views

FillPDF not displaying 'foreign' characters

I'm using the fillpdf module with the online FillPDF service to render the PDFs. Most everything is working great; however, if a database field I'm displaying on the PDF contains certain 'foreign' ...
0
votes
0answers
24 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 ...
0
votes
1answer
44 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 ...
0
votes
0answers
47 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 ...
0
votes
0answers
35 views

ddev sequelace not connecting (how to debug?)

According to this https://ddev.readthedocs.io/en/stable/users/developer-tools/#database-management we should be able to type ddev sequelace and have sequelace connect to the db server in ddev. However ...
-1
votes
1answer
227 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::...
1
vote
0answers
46 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 ...
0
votes
3answers
79 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 ...
0
votes
0answers
50 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::...
0
votes
0answers
16 views

How to capture the SQL on database errors

Is there a way to capture the SQL that was submitted to the database when the database throws an error?
0
votes
0answers
47 views

Dump raw select query with parameters values

I would like to debug select query and I use the next code, for example: $connection = \Drupal::service('database'); $query = $connection->select('node', 'node'); $query->fields('node', ['nid']) ...
9
votes
1answer
294 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(...
1
vote
1answer
51 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 ...
1
vote
1answer
123 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 ...
1
vote
2answers
164 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 ...
0
votes
1answer
66 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('...
0
votes
0answers
216 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 ...
1
vote
0answers
23 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 ...
-1
votes
2answers
197 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 ...
0
votes
2answers
211 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 ...
1
vote
1answer
119 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 ...
0
votes
0answers
69 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 ...
0
votes
0answers
583 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 ...
1
vote
1answer
69 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($...

1
2 3 4 5
62