Questions tagged [database]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
19 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
36 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
57 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
45 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 ...
-2
votes
1answer
34 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
28 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
49 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
17 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
54 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
17 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'...
2
votes
0answers
29 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
16 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
35 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
16 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
18 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
30 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
136 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
45 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
27 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
30 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
29 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
49 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
52 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
19 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
30 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
49 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
19 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
29 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
267 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
95 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
26 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
51 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 ...
0
votes
0answers
24 views

How to know if a field_config_instance is safe to delete

What I did, and my findings: I installed commerce_product_bundles module for D7, and found that it leaves 5 orphaned field_config_instances in the database after uninstalling: commerce_unit_price, ...
1
vote
1answer
64 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
46 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
13 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
69 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
20 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
0answers
79 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
28 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
59 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
46 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
165 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, ...
0
votes
3answers
234 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
156 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
23 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) { $...
0
votes
0answers
48 views

how to convert a timestamp into a date format in a custom module [duplicate]

I created a custom module and printed this outcome in .csv. Name,Event,Email,Timestamp Ea Iustum Jus,Fifa,example@asdf.wer,1573924224 How do I convert the timestamp in a date format? I tried with $...
1
vote
2answers
267 views

Where is the node created timestamp stored in the database?

I need to create an SQL query that finds all nodes of a certain type created X days ago, so I can get their IDs. Due to the massive number of nodes in the database, I would prefer to use a direct SQL ...

1
2 3 4 5
61