Questions tagged [database]

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

Filter by
Sorted by
Tagged with
-3 votes
0 answers
15 views

MongoDB is not connecting [closed]

I have drupal8 application where I use various dbs.when i try to connect with mongo db by giving username and password ,connection is not happening.I could connect with mongo db by mentioning server ...
user avatar
  • 1
1 vote
0 answers
27 views

Multiple value field create duplicate results when using leftJoin

I have a query to the database for a specific content type. Everything is working as expected but when I add a leftJoin query on the field 'node__field_country' which is a taxonomy term reference ...
user avatar
1 vote
0 answers
374 views

I can't import the configuration on production servers [closed]

I am unable to uninstall the MySQL module. I can't import the configuration on production servers when I upgrade Drupal from 9.3.x to 9.4.x. I get the following error. The import failed due to the ...
user avatar
4 votes
1 answer
47 views

Is it possible to have a nested SELECT in a WHERE clause using dynamic queries?

I need to execute this SQL query using dynamic queries. WHERE (node_field_data.status = 1) AND (node__field_document_places.entity_id IN (SELECT entity_id FROM node__field_document_places where ...
user avatar
  • 323
2 votes
3 answers
45 views

How to check if secondary database definition exists

Can anyone please help me on how to check if secondary database is set. If not throw an error. I am currently defining database connection as below. Database::getConnection('default', 'sqlite') I am ...
user avatar
0 votes
1 answer
22 views

Access FieldItem object from Widget

I have a custom FieldItem with a method doing a calculation on the field's values: class MyFieldItem extends FieldItemBase { ... public function getAmountInEuros() { $amount = $this->get('...
user avatar
0 votes
0 answers
14 views

TableSort with entity query aggregate

I'm trying to implement a table sort for a custom Drupal 9.x entity type Packet which represents published medical literature articles which have batched together and assigned for review. Each Packet ...
user avatar
0 votes
1 answer
74 views

How to solve "Mismatched entity and/or field definitions", specifically, "The URL alias field needs to be installed"?

After migrating from 7.89 to 9.3.12 this warning appears: ENTITY/FIELD DEFINITIONS Mismatched entity and/or field definitions The following changes were detected in the entity type and field ...
user avatar
2 votes
2 answers
64 views

How to use a referenced entity's values in a TableSort?

I have a custom entity with a field which is defined as follows. $fields['file'] = BaseFieldDefinition::create('file') ->setDescription('Reference to the built-in core File entity type.') ->...
user avatar
1 vote
0 answers
51 views

Trying to get to the bottom of an out of memory error related to the database

I've inherited a highly problematic site built in Drupal 7. Upon installing the site on my dev space I get a 'This page isn’t working' error 500. Looking at the web logs I get this message: lmu.[...
user avatar
  • 161
-1 votes
1 answer
51 views

Installer can't create sqlite database

I have a drupal page, hosted with azure webapps, on nginx. However, when i start the site, the installer wants to have a database. I am aware that it's bad, but sqlite is an intentional choice because ...
user avatar
  • 1
0 votes
0 answers
40 views

How do I set an incremental property on a custom field?

I built a custom module which creates a custom field type (with formatter and widget), and I would like to make one property of the field incremental (to increase its value by one for each instance of ...
user avatar
  • 247
1 vote
1 answer
55 views

Does a database transaction rollback if a PHP/Gateway timeout / connection dropped/lost occurs?

I am using Drupal behind a reverse proxy/cache layer (e.g. Cloud Front/ Akamai) and sometimes the service goes quite slow (so I get a Gateway timeout, for reasons such as too many people are using ...
user avatar
2 votes
1 answer
152 views

How do I get the names of the tables where field data is stored?

In Drupal 7, one was able to retrieve the physical names of the database tables using some code like the following, it was pretty simple. $field_definitions = field_info_fields(); foreach ($...
user avatar
0 votes
1 answer
61 views

"[message] => DB Error: no such table" error after installing civicrm

I installed CiviCRM 5.47.3 plugin using composer in the centos 8 server. my drupal version is 9.3.5 After installing CiviCRM on the server CiviCRM plugin is enabled automatically in admin extension ...
user avatar
1 vote
1 answer
34 views

How to check which module db updates have been applied?

For a specific module, how can I check which database updates have been applied in Drupal 9? I've downloaded a database from a server and I want to check what the current module schema is. In Drupal ...
user avatar
0 votes
0 answers
52 views

EntityQuery, exclude nodes with NOT IN from a multivalued entity reference field

Drupal v. 9.3.8 I recently used the entityQuery command and for simpler queries I had no problems. Now I need to filter, as well as for the '=' and 'IN' operators, also the nodes, whose multivalued ...
user avatar
  • 51
0 votes
0 answers
14 views

Update collation on tables on database update

For some module I have wrong collation in the database, it's about 5-6 tables created by that module. How I can update collation of these tables through db update (for example drush updb)?
user avatar
  • 1,584
0 votes
0 answers
29 views

Add prefix on tables break my site

I have an old site on an old shared server which used an old shared PHP 5 we can not update. I create a copy of this website which will run on a different (and dedicated) server with PHP 5.6 and ...
user avatar
  • 611
0 votes
1 answer
95 views

How do i save a base64 decoded image to file_managed?

I'm trying to save my image to Drupal's file_managed table. However, my image is coming from base64 decode: $filename = "sign-".$user->id(); // returns "sign-1234" $image_raw =...
user avatar
0 votes
0 answers
42 views

Get count of related entities

I have two entities, Post and Category A Post belongs to a Category via a entity_reference field type name category_id I want to get a count of posts belonging to a category (To prevent deleting a ...
user avatar
1 vote
0 answers
110 views

Installing to a MySQL database that requires SSL

I am attempting to install Drupal 9 to a fresh host using an AWS MySQL RDS instance for a database. The database is configured to require SSL. When attempting to install via the web GUI, I receive ...
user avatar
0 votes
1 answer
69 views

Change a node's type/bundle keep the old type/bundle in field tables

I need to change the bundle/type of some nodes. I tried https://www.drupal.org/project/convert_bundles but there was no way to select just a few nodes and change the bundle/type so I tried the very ...
user avatar
0 votes
0 answers
33 views

How can I increment and save an integer value in a single operation to avoid race conditions?

How can I increment and save an integer value in a single operation to avoid race conditions? With MySQL, I could use the following query. INSERT into mytable (logins) SELECT max(logins) + 1 FROM ...
user avatar
  • 1,359
0 votes
1 answer
231 views

ERROR 1062 (23000): Duplicate entry '/-de' for key 'PRIMARY'

When importing a dump from a production site with mysql in a xampp environment I got this error: ERROR 1062 (23000): Duplicate entry '/-de' for key 'PRIMARY' These lines are affected: ALTER TABLE `...
user avatar
0 votes
2 answers
69 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('...
user avatar
0 votes
1 answer
36 views

Where are path aliases stored?

I know that, in Drupal 7, path aliases are stored in the url_alias table. Which database table does Drupal 8 use to store path aliases?
user avatar
  • 43
0 votes
1 answer
127 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 ...
user avatar
0 votes
1 answer
110 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:/...
user avatar
  • 163
-1 votes
1 answer
52 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 ...
user avatar
3 votes
0 answers
492 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 ...
user avatar
1 vote
0 answers
39 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 ...
user avatar
  • 235
1 vote
1 answer
138 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'...
user avatar
  • 595
0 votes
0 answers
26 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 ...
user avatar
0 votes
0 answers
24 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 ...
user avatar
  • 892
0 votes
1 answer
72 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 ...
user avatar
  • 17
0 votes
1 answer
192 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,...
user avatar
  • 1,710
-3 votes
1 answer
70 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 ...
user avatar
0 votes
0 answers
29 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 = ...
user avatar
0 votes
0 answers
50 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->...
user avatar
  • 341
1 vote
1 answer
588 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 ...
user avatar
0 votes
1 answer
34 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://...
user avatar
  • 1
1 vote
0 answers
54 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 ...
user avatar
  • 57
1 vote
0 answers
39 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 ...
user avatar
0 votes
0 answers
156 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 ...
user avatar
2 votes
1 answer
33 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 ...
user avatar
  • 31
0 votes
1 answer
166 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 (...
user avatar
  • 1,584
0 votes
0 answers
33 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 ...
user avatar
  • 1
-1 votes
1 answer
168 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' => $...
user avatar
0 votes
1 answer
47 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')-...
user avatar

1
2 3 4 5
62