Questions tagged [database]

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

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

SQLSTATE[HY000]: General error: 1364 Field 'lid' doesn't have a default value: INSERT INTO {locales_source} (source, context, version) [closed]

The website encountered an unexpected error. Please try again later. Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1364 Field 'value' doesn't have a default value: ...
-2
votes
1answer
29 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
22 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 ...
-2
votes
0answers
18 views

How to create form for single field from user content type?

Drupal has a user content type to save registered user's datas. I created a file field on the user content type to get some file from the logged in users. I want to display the file field separately ...
-1
votes
0answers
28 views

How do I save file in the database using custom form in drupal 8?

I created a custom form to get resume file from user and save it to their profile. My custom form looks like this, $form['resume'] = array( '#type' => 'managed_file', '#title' ...
0
votes
1answer
16 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
30 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
79 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
24 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
46 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
51 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
25 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
12 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
41 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
18 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
38 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
20 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
40 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
45 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
91 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
55 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
62 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
20 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
227 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
18 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
47 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
30 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
44 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
60 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
133 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
23 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) ->...
0
votes
0answers
14 views

Items removed from Node Reference field are still displaying on the node

This problem only very recently cropped up; I've never encountered it before. I have a content type (Resource) that contains a Node Reference field (pointing to Organization nodes) that allows ...
1
vote
0answers
31 views

Delete user in transaction

I'm having trouble figuring out why the following code isn't working in Drupal 7. _queue_processor is a cron queue processor function: function _queue_processor($uid) { $transaction = ...
0
votes
0answers
34 views

How to add a UNION to a query in hook_views_query_alter?

I have a custom multiple-value field (via plugin) in a bundle that needs to have an dynamic entry added prior to rendering in the view. I've tried render hooks. The problem is that if there are ...
0
votes
1answer
36 views

How can I run a Views SQL query in PhpMyAdmin?

i go to admin/structure/views/settings, check Show information and statistics about the view during live preview and then Show the SQL query checkbox that will appear below. I have a field which is ...
0
votes
1answer
89 views

How to save the webform data to custom table?

I designed a student registration form using webforms module. My requirement is to save data from the form to table student. How can i achieve this? Is there anyway to mention this in configuration ...
0
votes
0answers
28 views

Expose custom db table to views to join with any entity data

We have a db table from custom module which has fields entity_id and entity_type. I need to exposed this table to views using hook_views_data() and it should be possible to join with this table within ...
1
vote
1answer
71 views

Can I get integers from a dynamic query using fetchAllKeyed?

So basically I want an array of integers from a query using fetchAllKeyed for the results. The field is an tinyint in the db so I would expect an indexed array of integers but I am getting an ...
1
vote
1answer
51 views

Fetching node field values programmatically

I have figured out how to query the node table programmatically without using the deprecated db_query() function. However, I soon discovered that the actual content fields are not held in the node ...
0
votes
1answer
13 views

Entity wrapper save using db_transaction()?

I am using a db_transaction() for some data updates. I am using some EntityMetadataWrappers, modify some data, then save. The thing is, the wrapper ->save() function doesn't have a parameter for $...
1
vote
2answers
51 views

Is it normal for a database to have 3600 tables?

I recently inherited a Drupal site and while trying to migrate the site and DB I noticed that the DB is 1GB+ and had 1000s of tables. This is the first time i work with Drupal so I'm not sure what ...
1
vote
3answers
22 views

Query fieldCondition for custom content type

I am attempting to query a custom content type called players (machine name) in a Drupal 7 module and it seemed to be working fine up until an hour ago. Nothing has changed on my side but now the '...
0
votes
1answer
31 views

Add second expression to query

I have a probably trivial question, but I could not find an answer. I have this query, which works fine: $query = db_select('books, 't'); $query ->fields('t', ['publication_year']) ->...
0
votes
0answers
38 views

Primary-replica using PostgreSQL

I have master-standby servers on PostgreSQL working perfectly. I followed Database Configuration and edited the settings.php file to contain the following code. $databases['default']['default'] = ...

1 2 3 4 5 61