Questions tagged [database]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
3 views

Unable to install site when attempting to upload a Background Process module

We recently added a new module Background Process to our local drupal environment by running the command drush en background_process -y. After installing, I was able to use the method ...
0
votes
0answers
20 views

Listing two different custom entity types in one view

We defined two entity types, questions and answers. They are related to each other but we will need a view listing all questions and answers in order of title or created date for example. When you ...
2
votes
1answer
29 views

Is there a way to get the max size of a varchar textfield?

I have an entity with a textfield created using the core Fields feature that looks like this when I inspect the type of the field table in the database varchar(40). I want to be able to determine max ...
0
votes
1answer
29 views

Where in the MySQL database schema is the URL alias for a group relation?

I am building a report outside of Drupal that pulls data from a Drupal 8 database. The report shows titles of different nodes and I want to link those titles to the web page for that content. This ...
-2
votes
1answer
19 views

Slow page load (seemingly large pulls from MariaDB)

We have a Drupal 8 site running on Windows/Apache/PHP7.2 that pulls data from a MariaDB server (on a different subnet - ie not in our DMZ) also running Windows. When a user is signed in to Drupal the ...
-1
votes
1answer
30 views

Fetch and update with foreach loop

I need to update the database. the code I am using was working, but after I have done some Drupal updates, it doesn't work anymore. I'm fetching data from table all is working but when I add code ...
-1
votes
0answers
20 views

“revision_id” error when creating a new taxonomy term

I tried to add a new taxonomy term and got this error: The website encountered an unexpected error. Please try again later. This is what I found in the logs: Drupal\Core\Database\...
0
votes
1answer
29 views

Delete a field from the database manually

I installed a module that left a ghost field that isn't tied to any entity bundle :( How would I go about safely and thoroughly deleting this field from the database? I have to delete this field to ...
-2
votes
1answer
20 views

Is there a way to determine creator of each table on an existing Drupal DB?

I am investigating Data Science stakes for a company and have started by exploring the data they have. They are running their website on Drupal (7.59), which, compared to a "traditional" relational DB ...
0
votes
0answers
10 views

Add a FULLTEXT index on specific column

I'm currently implementing a custom search engine in my custom module. In order to optimize my module, I would like to perform SQL queries by using the syntax MATCH....AGAINST in Entity queries. By ...
1
vote
1answer
25 views

How can I display custom data from the database in a View?

I'm working to create a new website in Drupal 8 and cannot figure out how to reference custom table data within a View. Specifically, I have a script that is taking data from an external DB and ...
0
votes
2answers
35 views

How to query external database for Count

How do I query the below SQL query to an external database table from Drupal 8 custom module, Select Count(requestID) FROM requestDB.request where request.dateCreated >= DATE_SUB(CURRENT_DATE, ...
0
votes
0answers
19 views

InnoDB not locking a SELECT statement using db_query()

From Any way to select without causing locking in MySQL? I found a way to implement a select query in a InnoDB table without locking. The example code given there is the following. SET TRANSACTION ...
0
votes
1answer
46 views

How owerride entity node delete core function

I'm doing a headless drupal cms. I need to check the entities before they are deleted. I need to do it globally as the deletion of entities can take place via api (already written) or by using the ...
0
votes
0answers
13 views

Installation on Oracle database using the Oracle driver

I have been trying to install/host Drupal 7 on Oracle Database as the primary database for last few days without any luck. Here is the Oracle driver link that I have looked at https://www.drupal.org/...
0
votes
0answers
26 views

Extra Content Appears Below Footer

I have an issue where I have the page for a specific role showing up on every page and additionally an error message. These show up below the footer on the pages. I've gone through the theme files ...
0
votes
0answers
42 views

Install in a specific PostGreSQL schema

I want to install & setup my Drupal databases in a specific schema of the PostgreSQL database. For example, let's say I have created a schema named "test_drupal" in my existing PostGreSQL database ...
0
votes
0answers
30 views

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1074 Column length too big

I am trying to update my database collations to utf8mb4 to support more characters (like emojis etc.) following this guide: https://www.jeffgeerling.com/blog/2016/getting-emoji-and-multibyte-...
0
votes
0answers
16 views

File uploading issue

We're having issues uploading files. Some files encounter an error message that states The specified file temporary://p1dah901n910tl8lv14.tmp could not be copied, because no file by that name ...
-1
votes
1answer
34 views

Drupal maintenance over several environments [closed]

I have a production environment for a Drupal 7 site. This environment is replicated to a staging environment, which we use for testing updates to modules and drupal core (same major version). We ...
0
votes
1answer
374 views

How do I perform outstanding entity updates after 8.7?

I have just tested the update to 8.7.1 (from 8.6.x) which includes the removal of the old automatic entity update functionality, which means drush entup no longer works. As far as I understand the ...
0
votes
0answers
46 views

How do I extend Drupal\Core\Database\Driver\mysql\Select?

Currently, my website uses MySQL. I want to override some methods on the Select when I use the following code. $query = Database::getConnection()->select('my_table', 'my_table'); $query->...
0
votes
0answers
8 views

use TableSort with multiple database tables?

I have a custom module where i want to show a table on a page. The rows of this table are the representation of a list of objects stored in database table A. Most of the columns show data from ...
0
votes
1answer
116 views

Error when upgrading to Drupal 8.7.1 on module menu_link_content

When running database updates (on domain.com/update.php) from 8.6.15 to 8.7.1, I got the following error: module menu_link_content Update make_menu_link_content_revisionable Custom menu links have ...
0
votes
1answer
51 views

How can I query a Drupal 7 database from Drupal 8?

I want to query users, nodes etc in my D7 database that I am currently migrating to D8 to compare with the migrated content. I want to use custom Drush commands to run some checks. Is this possible?
0
votes
1answer
129 views

Get node based target id from entity reference

We have an Article content type which has an Entity Reference field called field_document that is linked to the Media bundle type of Document. In mymodule we need to write a hook that will take the ...
0
votes
1answer
16 views

How do I apply an OR condition?

I've got the below code $query = \Drupal::database() ->select("excel", "e")->fields("e"); $group = $query->orConditionGroup() ->condition("grupindex", 1) ->condition("grupkodu", ...
1
vote
0answers
15 views

How to alter SQL queries in theme layer in Drupal 8?

In Drupal 7, we could use hook_query_alter() in theme layer since drupal_alter() made modules and theme run the alter functions, but in Drupal 8, it seems this as been restricted to custom modules....
0
votes
0answers
16 views

get value of select dropdown

I'm trying to take values from dynamic select boxes I retrieve them from the database here is the code foreach ($courses as $course) { $query = db_select('Lab'); ...
-2
votes
2answers
28 views

How to create a rule and inject mysql code?

Can I create a rule on my drupal 7 website and that rule will: Whenever a user is logged in (only logged in users can see this content) and a certain content is clicked I want to write a mysql update ...
0
votes
1answer
56 views

How to chart data stored in a database table (dynamically) in Drupal 8?

I found these instructions for using the Charts module to display data from a database for Drupal 7: https://www.drupal.org/docs/8/modules/charts/charts-howtos/chart-some-data-stored-in-a-database-...
0
votes
1answer
20 views

How i can create VIEW table using Drupal hook_schema()

i want to create a view table in my custom module .install file and i want join with another table like i did in my db_query function but i want this thing in hook_schema function. db_query('CREATE ...
0
votes
1answer
25 views

logging into development instance of Drupal

Ive rsynced the directory structure from mywebsite.com to mywebsite.local ( on my LAN) and copied the DB . the website mywebsite.local displays the website, but i cant log with the admin user/pw ...
-1
votes
1answer
103 views

Is MySQL 5.7 compatible?

My server has been on MySQL 5.6 for quite awhile and now I need to upgrade to MySQL 5.7. Is it safe to upgrade to 5.7 for all of my Drupal 7.x sites? Just doing a quick google for drupal 7 mysql 5.7, ...
-2
votes
1answer
41 views

Strategy for Import/exporting Drupal8 as content and structure

We are setting up feature>dev>production environments on Platform.sh for a Drupal 8 project. Expecting multiple contributors to the project, we have run into a slight snag regarding Importing/...
0
votes
0answers
9 views

Select statements against postgres table are returning null

I have a table, edm_info, located on the same postgres database as my drupal 7 site. I want to display information from the table on my drupal website. Using several different methods, I have ...
0
votes
1answer
11 views

SQL error when adding an other database table

The Code: In my module.install i am declaring my main database table. This works without any problems: function my_module_install() { create_initial_roles(); drupal_set_message("Installed module ...
0
votes
0answers
35 views

Drupal Black Box of Death

Does anyone know what it means when drupal appears to fail but displays this black box in the browser?
1
vote
1answer
47 views

How do I join across two different databases?

I have two databases, the normal drupal db and another db to another system. I want to join two tables from these two different dbs. I have already set up the second database using information from ...
0
votes
0answers
32 views

Efficient way to get entity information

Which is an efficient way to fetch entity label and id? Database query or entity query with entity load? I need to get the list of all taxonomy terms in an associative array of ID and Label. I can ...
0
votes
0answers
257 views

PDOException: SQLSTATE[HY000] [2002] Connection refused Upon Drupal 7 Installation

I have already installed LAMP in my Ubuntu 18.10 server. I have also downloaded Drupal 7 files. But after I navigate to http://10.0.34.74/drupal-7.65/ in my browser. The error below occurs: Error The ...
0
votes
0answers
51 views

Use a custom Table/Storage for a Custom Field

I want to create a DR8 content field, which has no field tables, and passes the save and load mechanisms to a custom table. Is there a way to do this? I've been able to prevent saving with: class ...
-2
votes
1answer
30 views

When will doctrine ORM be implemented for modules? [closed]

I am looking at Drupal for some websites I want to set up. I have been a Symfony developer in the past so would like to use doctrine when I create a custom module. Is it implemented in 9 dev yet? Any ...
0
votes
1answer
25 views

Custom database connection

What is the best way to connect to a remote database through drupal? Would the correct method be to use the settings.php with the database in there, and use the built in db_select, db_query() etc ...
0
votes
1answer
26 views

How do I retrieve media from a reference field?

Inside a node type, I have a reference field to target a media. With a db select, I need to load all related medias of the nodes. For this I use this code: $database = \Drupal::database(); $result = ...
1
vote
1answer
35 views

How to show the following n events with respect to the current date or the past events to always ensure n elements in the view?

I have an agenda on my homepage, and I want to always ensure 5 events. If there are 5 or more following events (including the current one), show the nearest 5 from the start date. If there is less, ...
1
vote
1answer
32 views

Delete in lieu of truncate?

If my DB user doesn't have permission to truncate a table - would using delete instead without any parameters be equivalent? So like - $this->db->delete('data')->execute(); in lieu of $...
3
votes
2answers
205 views

\Drupal::database() ->insert - Error: Call to undefined method Using ->condition()?

I am trying to insert a new row based on conditions. The ->condition() in $database->update() works fine, in $database->insert() they do not. $database = \Drupal::database(); // Query our ...
0
votes
1answer
26 views

Get default value of a node field

I have a field on a node which has a default value set, I need to access the default value of that field. But, I don't want to load any nodes of that type and access the field definitions, nor do I ...
0
votes
1answer
15 views

Add a having condition that makes use of COUNT

I currently have a query that compiles to SELECT n.nid AS nid, field_data_field_date.field_date_value AS incident_date, field_data_field_tweeted_date.field_tweeted_date_value AS tweeted_date, n.nid ...