Questions tagged [database]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
25 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
25 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 ...
0
votes
1answer
20 views

Query a table where field type is MEDIUMTEXT

I'm trying to get webform submission data from the database. My webform has a hidden field for a related node id, but I cannot use a query with a condition on the field. In the database, the field ...
1
vote
1answer
33 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($...
3
votes
0answers
35 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 ...
0
votes
0answers
21 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 ...
0
votes
1answer
27 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 ...
1
vote
1answer
21 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 ...
1
vote
0answers
26 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 ...
1
vote
1answer
32 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 ...
0
votes
0answers
24 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 ...
0
votes
0answers
19 views

hook_update_N column addition - error

I am adding 2 columns to an existing table using hook_update_N function as below: function cca_update_8904(&$sandbox){ $connection = \Drupal::database(); $schema = $connection->schema(...
2
votes
2answers
81 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....
1
vote
1answer
100 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 ...
4
votes
1answer
67 views

Force a single value base field to be in a separate table?

I have a custom entity type (eg: myentitytype), and I would like to add a new base field to it via hook_entity_base_field_info(). As I understand it, single value fields (with a cardinality of 1) will ...
0
votes
1answer
46 views

Why isn't a PDO driver detected on the install page?

I have an old Drupal 7 project and I need to set it up on my localhost. I have Ubuntu 16.04, Apache 2, php 7.0, and MySQL 5.7 installed. Everything is working fine for other PHP scripts, But when I ...
1
vote
2answers
73 views

How to run custom sql commands to database programatically

I'm using MariaDB as database backend and I would like to use built in "Sequences" to get an integer number generator. I need to dinamically create sequences and get their values. Following ...
1
vote
2answers
44 views

How to make a case sensitive entity query?

My custom entity type comes with a string field for which I would prefer case sensitive queries. When I use $query = \Drupal::entityQuery('my_entity_type') ->condition('my_token_field', '...
1
vote
2answers
117 views

LogicException: The database connection is not serializable - when I try to open any “gear” on checkout flow page?

So I'm on Commerce -> Configuration -> Orders -> Checkout flows. I'm editing a flow (it's the same with any of them), so i.e. I'm at page: /admin/commerce/config/checkout-flows/manage/...
0
votes
2answers
62 views

How do I edit serialized values in “config” and “key_value” tables?

While trying to switch original language of a Commerce product type I've encountered longblob serialized data in config and key_value database tables. Is there a quick way to edit them, possibly ...
-6
votes
2answers
54 views

Is it possible to import an SQL file? [closed]

I have an SQL database created from another application and I would like to add it to my existing Drupal 8 site. I didn't find a way to do so. I came across the Data module, but I have no idea how to ...
0
votes
1answer
49 views

How should I get data from the node table?

I am creating a Drupal Dashboard (PHP 7.2, Drupal 8.9). I'm trying to query the node table using the following code. $database = \Drupal::database(); $query = $database->query("SELECT ...
0
votes
0answers
38 views

How to install drupal 9 with PostgreSQL using Docksal?

I use docksal for developing on Drupal. Recently I decided to install Drupal 9 with PostgreSQL as a database using Docksal. Firstly, I cloned this git-repository. https://github.com/docksal/...
0
votes
1answer
30 views

Extracting user field values from dynamic SQL queries

Aim I have successfully written a fairly long dynamic sql query, however am struggling with a seemingly simple part at the end. Although, I am able to successfully extract mail and name from the users ...
0
votes
0answers
40 views

Override core files database, statement, connection

I'm trying to turns things in everyway in order to override those core files: Database, Statement & Connection in order to build a simple array of SQLQueries along with their results in order to ...
1
vote
0answers
33 views

Database dump without revisions?

Are there methods to exclude revision data in a database dump? The purpose would be to reduce the file size for developers that want a db dump for local development. I know that drush sql-dump has an ...
0
votes
0answers
40 views

Rollbacking from Yaml based configuration to database based configuration

We recently changed the way we deploy our Drupal site on our testing environment to a docker image. The issue is that we were using a file based configuration. The current applied configuration is not ...
0
votes
0answers
30 views

how to download media into drupal 9 database from a sql database

here my problem i have old blog made in laravel and my boss want me to migrate all the article to a drupal website so i create a plugin that migrate the article title and text but i have to download ...
0
votes
0answers
10 views

How do I restore/recreate accounts created using OpenID after restoring from a backup?

After performing a rollback of our Drupal 7 site, we realized we had 20 - 30 users that were "lost". Looking for the most efficient / possible (?) way to recreate those users with the least ...
1
vote
0answers
91 views

Is it safe to truncate the key_value_expire table?

I am seeing over 8 GB in the database for the key_value_expire table. Is it safe to manually truncate that table? This appears to be caused by a bug in the Honeypot Module, which I am unable to ...
0
votes
0answers
14 views

How to update value of single field of same node using node_save?

The problem statement: I have one content type called 'Employee' which has 10 nodes. I have to perform the voting for each node. I am saving the vote count in the field called 'vote count'. But when ...
0
votes
0answers
25 views

migration plugin works but fail to migrate in drupal database

I try to migrate old blog article to a drupal website here is my migration class : class Article extends SqlBase { /** *{@inheritDoc} */ public function query() { $query = $this->...
0
votes
0answers
60 views

Why my Migration don't reckognize my plugin in drupal 9

I'm new in drupal and I try to migrate the article of an old blog with sql database to my drupal 9 project. I follow the instruction give by the drupal API migration docs, so i connect the 2 database ...
0
votes
0answers
47 views

What is the correct way to use an in-memory sqlite database for Unittests?

I have found vague hints on the internet that we can speed up Unittests with an in-memory database by using the following line in our phpunit.xml file: <env name="SIMPLETEST_DB" value=&...
0
votes
0answers
16 views

Drupal EntityFieldQuery() returns partial result set

I have used the following code to return the vids of all the playlists associated with a particular program. $query->entityCondition('entity_type', 'node') ->entityCondition('bundle', '...
0
votes
1answer
30 views

where in database is renamed login for 'Rename Admin Paths"

A little embarrassing - I've lost/forgotten the login page for a Drupal 8.9 website. It was renamed using the module "Rename Admin Paths." I've gone to the module page at drupal.org and ...
0
votes
1answer
49 views

How do I create a table when a module is installed?

I want to add a custom table when a module I develop is installed. The code I am using doesn't seem to work, as the post table isn't created. What is wrong with the code I am using? /** * Installs ...
0
votes
0answers
21 views

Incorrect field of a content type in its display after migrating from a backup

The following two screen shots should explain the issue well: Here I have a content type Poll, where the first field is Question with machine name title. However, in Managage Display tab, the second ...
0
votes
0answers
20 views

EntityQuery get contents which were not modified [duplicate]

I'm writing a very basic query to get the count of contents which were not modified. The logic I'm applying here is simple too, just check if created = changed The SQL query is pretty straightforward ...
1
vote
1answer
207 views

Error: “module does not exist” after I removed a module from the file system without disabling and uninstalling it

I removed a module from the file system without disabling and uninstalling it. And now I have error: Drupal\Core\Extension\Exception\UnknownExtensionException: The module drupalweather does not exist. ...
0
votes
1answer
92 views

How to make loadByProperties or entityQuery case sensitive for field value

Neither loadByProperties or entityQuery are case sensitive. How to make it case sensitive? I'm using MySQL as a database but would rather have a portable solution if possible. With LoadByProperty $...
1
vote
1answer
51 views

Why cannot I choose MySQL as database type in the installation page?

I downloaded the Drupal archive and extracted it on the dedicated server. In cPanel, I created a MySQL database, but when I try to install Drupal, in the Database configuration page, I can only choose ...
-1
votes
1answer
38 views

Ordering in a query gives “call to an undefined function”

I am using Drupal 8 and I am trying to order my query like so: $query = db_query("SELECT * FROM `heritage_source_info`WHERE text_id = :textid AND format = :format ORDER BY type ASC", [':textid' =>...
1
vote
2answers
32 views

How to get fetchField using db_query?

I wrote db_query in two ways, I followed the drupal documentation to write safe db_query, one of them doesn't work, I want to know what I'm doing wrong in the code below. // Worked perfectly function ...
0
votes
0answers
52 views

Database Rollback Transaction?

I have a multi database site, when I save my content type it is added in both the Laravel side database and the default Drupal database. Now most of my code is in try catch and it does not save data ...
0
votes
0answers
28 views

Adding content throws query exception after upgrading

I have a Drupal 7 site I am upgrading to Drupal 8. After running the upgrade process on a fresh installation of Drupal 8, all content seems to be imported correctly. However when I try to add or edit ...
0
votes
2answers
93 views

How can I retrieve a user name and password?

Someone installed the drupal 8 site and did not share the password. I do not know what email he has used to install the site either. I do not have the password. In phpmyadmin, I clicked the database ...
0
votes
0answers
42 views

I have large gaps in NIDs on my site. Should I clean it up?

So, since I have a little extra time on my hands I’m doing some delayed maintenance on my personal site. You know, removing modules I don’t need anymore, cleaning up taxonomy, etc, etc. There is ...
0
votes
1answer
19 views

query condition comparing two fields

i am having this query : $db = \Drupal::database(); $exist_query= $db->select('user__roles', 'ur'); $exist_query->fields('ur', ['entity_id']); $exist_query->condition('ur.entity_id'...
1
vote
0answers
36 views

How to add having to entity query Drupal\Core\Entity\Query\Sql\Query

I need to alter the query in getEntityIds method in PathAliasListBuilder i need only to get only paths with multiple path system: The sql select should be like: SELECT * FROM `path_alias` GROUP BY `...

1
2 3 4 5
61