Questions tagged [database]

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

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

How to fetch data from database using EntityQuery Drupal 8? [duplicate]

I need help. I am working on group module. I have group type named as drupalcamps. I have field in group type named as "field select theme" and also it make table in database named as ...
0
votes
1answer
16 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. ...
-3
votes
0answers
17 views

Best way to create custom page with statistics [closed]

I would like to create some statistics: total number of registered users, total number of subscribers, total number of registered users online on website without paid membership and so on. I'm trying ...
0
votes
0answers
50 views

How is one supposed to subclass PagerSelectExtender? [closed]

After reading the assumably-outdated Drupal docs page* on Database API extenders, I have the following code in /var/www/mysite/web/modules/custom/my_module/src/QueryExtender.php: <?php namespace ...
0
votes
0answers
18 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
23 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
40 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
24 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 = ...
-1
votes
0answers
18 views

How to add new column in existing database table programmatically drupal 8? [closed]

I am new to Drupal 8 and i have table named "url_alias" and i want to create column/field in that table programmatically. Any idea will be appreciated. Thanks in advance.
0
votes
0answers
28 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' =>...
-2
votes
0answers
29 views

How to restore content from a corrupted database

While doing an update recently I think something happened to my mysql database which causes problems with the website when I try to use it (The table itself isn't showing any corruption.) I'm trying ...
-1
votes
0answers
49 views

How do I order by “LIKE '%string'”?

is there a way to achieve something like the following in Drupal 8: order by ( n.title LIKE '%string1%') desc, ( n.title LIKE '%string2%') desc Edit: To clarify I use \Drupal::database()->select to ...
0
votes
1answer
27 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
43 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
36 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
17 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
26 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
17 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
89 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 = ...
1
vote
1answer
82 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
25 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
50 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
23 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
57 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
28 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
48 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
19 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
46 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
22 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
53 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
123 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
90 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
95 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
236 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 ...
0
votes
1answer
20 views

Database Abstraction to Fetch published content of specific content type throwing error

I'm attempting to grab all published content of type 'homepage_slide', as currently my slider loads all content unpublished or otherwise. Here is my current Abstraction query. if ($variables['...
0
votes
0answers
30 views

Querying entities taking an insane amount of time

Is the entity system in D7 not very well optimized? I am trying to iterate through 1500 entities using EntityFieldQuery(), and I had to extend my execution time to 300 seconds in order for the ...
1
vote
1answer
49 views

What is error: “Base table or view not found: 1146”

Base table or view not found: 1146 Table '(database).(entity)__(field_name)' doesn't exist I have problems running my site since i deleted field (field_name) from entity (entity), to be clear entity ...
0
votes
0answers
31 views

How to get only published revisions of a node?

I have several types of content that are moderated(content_moderation and workflows), in a custom validation process I need to know if a particular node has at least one published revision. Is there a ...
-2
votes
1answer
48 views

Installing a module on a separate database

I currently have a Drupal 7 site with a big database. I have to install the Drupal Commerce module and I would like to install the module using a separate database. I know I have to setup the second ...
0
votes
0answers
69 views

Notice: unserialize(): Error at offset XX (removing Paragraphs)

I'm trying to remove Paragraphs and modules related to it manually (because I can't remove it completly from admin page). I'm using UTF8 without BOM in Notepad++ when editing key_value BLOB file that ...
0
votes
0answers
18 views

How to disable all webform modules from phpmyadmin [duplicate]

How can I disable all modules related to the webform (WEBFORM EXAMPLE, WEBFORM DEMO and WEBFORM) from the phpmyadmin? Since I installed them all I am unable to access the admin panel. It does log in ...
1
vote
0answers
175 views

Drush cannot connect to the database when updating

I am trying to update Drupal from version 8.7.5 to 8.7.7. I installed Drupal using composer and had a really old version of Drush that I had installed from apt-get. I uninstalled the old version and ...
1
vote
0answers
24 views

How to create a query nodes, that queries content with more than one comment?

Consider this example: $query = \Drupal::entityTypeManager()->getStorage('node')->getQuery(); $nids = $query->condition('type', 'question') ->condition('status', 1) ->...

1
2 3 4 5
61