Questions tagged [database]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
31 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
51 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 ...
0
votes
1answer
304 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
109 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
56 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
41 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
33 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
33 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
133 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
21 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
37 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 `...
0
votes
0answers
18 views

module backup_db > php fatal error : “Connection to pgsql failed…”

I have successfully installed Backup Database module on my Drupal 8.8.1 (php 7.2) + postgres 9. When I run "export" > php fatal error : Exception: Connection to pgsql failed with message: ...
0
votes
1answer
330 views

“Drupal already installed” Message on Restored site

We had an issue on a Drupal 8.8.2 site, had to restore DB, Core and Vendor, now anyone visiting the site gets the site as normal, but if admin logs in I receive: Drupal 8.8.2 Drupal already installed ...
0
votes
0answers
36 views

Deleting a Site Entirely

The requirements of the project I'm working on changed dramatically and it was easier to build a new Drupal sure than to try and reconfigure the old one. Now, I want to delete the old site to free up ...
0
votes
1answer
18 views

PHP query in a view will cause website error

I'm using a global PHP query in a View to find out the count of membership users. The first query, that extracts the total number of users from the database works fine, but when I use the WHERE clause ...
0
votes
1answer
22 views

Trying to list all articles where category field is empty

I have drupal 7 site and I'm trying to listing all articles (with title) and where category field is empty (taxonomy). I'm running this code in my page with ->isNull and without, but not any results. ...
0
votes
0answers
177 views

how to save field data on form submission programmatically in drupal 8?

I alter the form with hook_form_alter and created field in it. Now i want when i submit the form data/configuration stored in database of that field. how it will be possible below is the code. Thanks ...
0
votes
1answer
2k views

PDOException: SQLSTATE[HY000] [2002] No such file or directory in lock_may_be_available() (line 167

I have Drupal 7.2 application site and have upgraded from php 5.6 to php 7.2 since it reached its eol, also upgraded to rhel 8 from rhel 6.5, but while connecting to rds I am getting following error, ...
0
votes
0answers
63 views

Excessive updates to cache_container table

I am maintaining a large drupal instance (10 nodes). Recently I am facing an issue. The website was up and running. But the database was overloaded, MySQL binary logs kept growing abnormally, ...
0
votes
0answers
46 views

How to save field data of one table to another existing table in drupal 8?

I am new to Drupal 8. I am working on the Group module. I alter group form and make select list field in that form. Now i want to save content of this field to other existing table (table_name = ...
0
votes
0answers
36 views

Add database connections on the fly, instead of defining them in settings.php

I am trying to add DB Information on the fly, instead of defining in settings.php I am adding connection on module install $other_database = array( 'database' => 'pantheon', 'username' =>...
0
votes
1answer
34 views

Deployment of full database dump still causes error

I want to deploy my local DB to a staging server. The local DB dump was exported with all tables. Including the "cache_" prefix table structures with no data exported. After deployed to staging (...
0
votes
1answer
60 views

Get field content of all instances of a field

I'm trying to get the content of all instances of certain fields based on their names. I've got a list of fields (which are in nodes/paragraphs and blocks) of which I want to extract the values from. ...
2
votes
1answer
124 views

Emoji works in a site but not in the other site on the same host

I am trying to enable emojis following Multi-byte UTF-8 support in Drupal 7. I have added the following to the settings.php file. 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_general_ci'...
2
votes
0answers
29 views

database update warning but no updates - google tag module issue?

I'm on Drupal 8.8.2, and we've got a "database out of date" alert, requiring us to do database updates. When I attempt to do so at update.php, I get a message saying "no pending updates" I re-ran ...
-2
votes
1answer
33 views

How to query a custom content entity with fields added with UI?

In a custom module (assoc), I have a custom Content Entity (Person) with some fields: $fields['lastname'] = BaseFieldDefinition::create('string') $fields['firstname'] = BaseFieldDefinition::create('...
0
votes
0answers
143 views

Database migration from Postgres to Mysql

We have a website in Drupal 7 running on Postgres database. We are planning to upgrade to Drupal 8 very soon, but we want to first migrate the database from Postgres to Mysql. I was just wondering ...
0
votes
1answer
21 views

\Drupal::database()->select with Expression used as Condition

I am trying to execute this query: 'SELECT sd.entity_id AS entity_id, WEEK(node__field_start_date.field_start_date_value) AS week, YEAR(node__field_start_date.field_start_date_value) AS year FROM {...
0
votes
0answers
30 views

MAMP losing one of my tables

I am using MAMP to host a Drupal-7 database on Mac OS 10.12 (Sierra). It works just fine until the first time I sign out and shut down my computer. When I come back, and try to "add content", I am ...
0
votes
1answer
615 views

Can't connect to remote DigitalOcean database

I am attempting to connect an existing Drupal 8 site to a DigitalOcean managed Database. The connection info I've received from DigitalOcean: username = digitaloceanadmin password = password host = ...
0
votes
1answer
131 views

Using taxonomy exposed filter in a view ends in MySQL can only use 61 tables in a join

Scenario One hierarchical vocabulary called Countries with 300 taxonomy terms, one for each country, indenting like: America (level 1) Anguila (level 2) Antigua y barbuda (level 2) ... (level 2) ...
0
votes
0answers
27 views

Drupal Site Migration from FreeBSD 12 to Ubuntu 18.04 SQL database unknown behavior

I am currently trying to migrate the Drupal Site from FreeBSD 12 to Ubuntu 18.04. All the configurations are copied and moved to Ubuntu 18.04. Everything seems fine and I was able to create the Drupal ...
0
votes
2answers
75 views

Connection issues

New to Drupal 8 and tripped up on this one. It seems something wrong with database but if anyone has tips please let me know! Here is my code: and here is error: And my drupal site isn't working at ...
1
vote
1answer
72 views

I cannot delete Devel generated content because I get an error about a not existing table

I'm trying to delete some generated content but I get an unhandled exception in the log. Drupal\Core\Entity\EntityStorageException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '...
0
votes
1answer
106 views

How do I compare fields in a database query?

Given the query fragment: $query = $connection->select('mytable', 't'); $query->addField('t', 'myfield1', 'myfield1'); $query->addField('t', 'myfield2', 'myfield2'); I need to add a ...
0
votes
1answer
14 views

How to query for a list of tables in a secondary database

I'm working on some Functional tests on a secondary database. Part of the tear down process is to drop tables in the secondary database. How do a make a query like 'show tables' where I can iterate ...
1
vote
2answers
124 views

PostgreSQL unbuffered query

I am producing large query results that can exceed a sizable PHP memory limit (128 Mb). I've been trying to address this and came across unbuffered queries. Unfortunately, these only seem to be ...
-1
votes
1answer
23 views

How to Update db field value in hook_menu()?

I'm using Drupal 7, my requirement is to automatically update the node field value in a content type for a condition. I have used Hook_menu() for to get a link and if i use that link my code will ...
0
votes
1answer
259 views

How to solve “Query failed” error in drush sql-sync output 2?

I have the exact same problem as in How to solve "Query failed" error in drush sql-sync output?, exact same output. That user found the answer as the password in settings.php was wrong, but ...
0
votes
1answer
41 views

db_select with groupBy(CAST(column as DATE))

I am looking to achieve GROUP BY CAST(date_time AS DATE) in a db_select function in Drupal 7 but with no idea how. The function up until now is: foreach ($distinct_users as $user){ $day_record =...
0
votes
1answer
83 views

Can I use the Migrate module to sync a site database with a Filemaker Pro database?

Is it possible to get data from a Filemaker Pro database and insert it into the database for a Drupal site? Ideally, I'd like to set this up so that Drupal would periodically check the Filemaker ...
0
votes
1answer
49 views

How to create a user with custom fields?

On my drupal site, using the User module, I have added extra fields to the user registration form such as 'Organization'. I notice that this has created a mysql database called '...
0
votes
0answers
211 views

There was a problem creating field: SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value

I've recently downloaded a Drupal website to work on a local host (xampp). After importing the database, changing the base_url and running the update.php script, I managed to make it work. However, ...
2
votes
3answers
1k views

EntityQuery for taxonomy term of specific bundle

I would like to build a query for all taxonomy terms of a specific bundle. $terms = \Drupal::entityQuery('taxonomy_term') ->condition('type','mail_template') ->execute(); This returns an ...
0
votes
1answer
285 views

How to find a field name/column name of a field in database where I have only the label of that field?

I am working on an integration part with drupal framework. Here it's hard to find the table names of the field which is present in the view as I know only the field label name. Is there any way to ...
1
vote
1answer
25 views

Database API and Security

I'm working on a controller that queries a table based on the value in a route parameter Example route path: path: '/path/{parameter}' Controller: public function myFunction($parameter) { $...

1
2
3 4 5
62