Skip to main content

Questions tagged [database]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
338 views

Postgres SSL PDO config for config/db.php

Struggling to configure this correctly and cleanly. When I upgrade to latest 3.x Craft on staging, Craft can no longer connect to the Postgres DB, which uses SSL. Have had success up until CraftCMS ...
1 vote
1 answer
301 views

Database Connection Error after updating from Craft 2 to 3

Good evening all, I am updating a small site from Craft 2 to 3, and after following the instructions in the documents, I loaded up the backend of my site and was greeted with the install screen. I ...
0 votes
0 answers
17 views

Adding an entry to an Entry element duplicates it

I have a site where the database is is some weird state which I would like to fix, but I'm not sure where to start. I have a channel of entries, and some of these entries (not all of them) suffer from ...
1 vote
1 answer
164 views

Special characters like ✓ are not being saved in text fields

we have just noticed that characters like ✓ are being saved in the title field but not in plain text fields regardless of the database type (PostgreSQL / MySQL) or field type in the database (text, ...
1 vote
1 answer
43 views

Use table prefix after installation

I finally have been able to install Craft CMS. During installation I left the table prefix field empty. I assume that for each site separate tables are created. Therefore, it would be more user-...
0 votes
0 answers
33 views

Best Approach for Merging Two Craft CMS Sites with Database Changes to Avoid Data Loss?

I'm currently in the process of merging two Craft CMS websites into one. To achieve this, I've made several changes directly to the database locally, rather than managing these changes through Git and ...
3 votes
4 answers
9k views

Craft can't connect to db

Hope you guys can help. I was working on my Craft site locally and now trying to upload it to the server but no matter what it says "Craft can’t connect to the database with the credentials in craft/...
1 vote
1 answer
40 views

Relations query with OR: Find entries based on (lightswitch = false AND relatedTo()) OR (lightswitch = true) / nested relatedTo?

I have the following challenge: we have a news channel for multiple company locations. Some news should be visible globally (for all locations), but some news are only visible for location X. But ...
1 vote
1 answer
50 views

Infrastructure design

For a variety of reasons, we have been asked to look at hosting CraftCMS and our websites on-premises, which I gather is somewhat rare. As the infrastructure guy, I have some basic design questions I ...
1 vote
1 answer
84 views

Craft 4 DB connection works in WEB context but not from Craft's console command

We just completed an upgrade from Craft 3 to 4 (latest version) and now all web requests (FE+CP) work, but not the console commands, it can not connect to the database ./craft users/list-admins ...
0 votes
0 answers
28 views

Limit External API Calls From Plugin In Craft 2

I have a plugin in Craft 2 that will make an API call to an external API to gather and display data on a template; however, I would like to limit the number of calls to a certain number per second (or ...
1 vote
1 answer
221 views

Craft 3 DDEV Migration: "No database has been selected yet"

I've hit a snag while trying to move my Craft 3 project from MAMP to DDEV. First I installed a new DDEV project using the php project type and MySQL 8.0 for the database. Then I imported the database ...
0 votes
1 answer
67 views

Duplicate queries out of the box?

I'm trying to strip back duplicated queries on a site, but after removing as much as possible from the homepage so nothing is coming from the CMS I'm still getting 7 duplicate queries. Is it possible ...
2 votes
2 answers
179 views

Access some sort of db in docker

I've been absent to webdev for a while and trying to get up to speed with this new ddev thingy. So I installed craft 4 via ddev and docker and such. And now I want to import an older db. Is there some ...
0 votes
0 answers
80 views

Duplicate entry '2022' for key 'categorygroups_sites.PRIMARY'

I'm trying to get a live site running locally (using DDEV) and having trouble importing the database. The database is an export from the live site (which is running and has been for a short time). ...
2 votes
2 answers
262 views

How to UNION Craft blog articles array with Social Media plugin (non craft table)

I'm looking for a way to merge blog article entries with social media entries (non craft table). The idea is to output both entry types together from the same array, this will allow me to order all ...
1 vote
2 answers
265 views

How can I change the Date Created for Assets?

I'm using graphql to pull in some assets/pdfs and ordering them by dateCreated, however the files go back a few years (i.e. files from 2019, files from 2018 etc.) but they weren't uploaded in the ...
2 votes
1 answer
47 views

200 new lines in elements_sites per entry

I noticed that the ID number of my entries has increased to almost 50.000, but I have around 1.000 entries and 2.000 files. I understand that other things like categories also affect that number, but ...
1 vote
1 answer
239 views

How can I change the local host url from http://localhost:8888 to something custom

I've looked everywhere and can't find a solution to my issue. I'm in the process of setting up a local Craft 3 site and have a question regarding the URL setup. When I originally installed Craft I did ...
3 votes
2 answers
8k views

Migration of Craft CMS from one host to another

I'm a newbie in Craft CMS. I need to make changes in an existing craft website which is with one hosting platform. The site was previously managed by another developer. I need to migrate to a new ...
1 vote
0 answers
24 views

Merging production version into local environment

My live Craft site was built by another dev a while back just before I joined the company, at the time of launching it I had it setup locally with docker and the most recent site files. Since it has ...
1 vote
1 answer
123 views

Using index hints to get around performance issues with large structures table

We're experiencing performance issues in CP stemming from having a decent number (>20k) of records in structures and the mysql is using the wrong index (dateDeleted instead of primary). This issue ...
1 vote
1 answer
343 views

How to write SQL query for live/current version of Craft entries?

I maintain a Craft 3.4.17.1 site for a non-profit client and it's grant-reporting season. My client has asked me to put together a quick-turnaround offline report of all the content we published this ...
1 vote
1 answer
31 views

Database lose data, cleaning?

I noticed that my database has lost 700Mb of data between two daily backup (between 14th and 15th of december) without any config change on our side. I can't download them for the moment and compare ...
0 votes
0 answers
72 views

PostgreSQL performance

Looking for someone well versed in the dark arts of PostgreSQL for some potential consultancy (or anyone that can offer hints, tips and advise). We have always worked with MySQL and made some naïve ...
0 votes
1 answer
164 views

Database not backed up because the backup command is false

I can't export my database in the control panel. Craft 4.2.3, server is running multiple Craft instances and this is the only one getting this error. I'm not getting anything out of the logs, maybe ...
0 votes
1 answer
709 views

How to update from Craft version 2 to 4?

I'm working with a Craft site that's running on version 2.6 and I need to get it updated to the latest version. My first approach was to just start a fresh site and then import the existing database, ...
0 votes
2 answers
2k views

How to fix corrupted Craft project config files

Looking to get some advice on fixing some issues I'm having with my Craft DEV environment. I merged some changes which worked fine locally, but are causing some issues on my deployed version. Problems ...
1 vote
1 answer
201 views

Should project config be used during development when migrating from Craft 2?

I'm looking for general advice on the best approach to handle a reasonable sized Craft 2 site to Craft 3.1, related to DB changes. Because the Craft 2 project is live and constantly changing, I ...
1 vote
2 answers
491 views

Deleting Duplicate Fields Brings down Craft Website and Server

I have somehow managed to duplicate some fields in my Craft install (see image of unused fields). When I delete the unused duplicates I create a server error and can't access Craft. To rectify I had ...
1 vote
1 answer
407 views

Getting column not found when using 'Entry::find()' to find the matching channel entry in custom plugin

We are building a plugin to perform some custom operations with an ERP system. We created a section for managing the users from ERP. We are able to create new users as channel entries and update them ...
1 vote
1 answer
131 views

Increment automatically the number field

I'm building a component in which the value of a number should be increased every 2 hours by 0.1. What would be the best solution for that? I have a field type number with the value 1200 by default. ...
0 votes
0 answers
191 views

Why is my database stuck at the 'Creating sort index' query?

So I imported the production database locally and it is getting stuck at the 'creating sort index' stage of the query when I try to log in to the CMS. This is the Server Process table from SequelAce ...
3 votes
1 answer
716 views

DB CPU running at 100%, Pages Never Load, Moving from MySQL to MariaDB

I've been running a somewhat busy database (~800Mb) in GCP SQL. Due to the cost of it I've been working on migrating to a custom server running MariaDB. Which I'd heard could be much more cost ...
1 vote
1 answer
623 views

How to retrieve (& output via twig) one key pair of json object stored i a database column

in commerce, all transactions are written into the database, into the table "commerce_transactions". every transactions will result in a row, where different data is the stored into columns. ...
1 vote
0 answers
51 views

Limiting image transform totals in queue?

In order to serve webp images where possible, and different sizes for different screens etc, I created a bunch of image transforms over the weekend - forgetting just how many images we have in the ...
1 vote
1 answer
92 views

Sharing data between Multiple Craft 3 CMS instances

I am not asking about multi-site. Rather, I am curious if there is existing support for "sharing" data across unique Craft 3 installs. For instance, let's say he have 2 Craft 3 installs ...
0 votes
0 answers
48 views

Character encoding problem when move between PCs

I'm using MAMP PRO to develop site in local environment with Cloud functions for sync. Everything works fine except for character coding of entries' text. Evidently a problem with encoding but I can't ...
2 votes
2 answers
720 views

Where are Matrix Entries Fields Relationships in the Database?

I can see the simple matrix field data in the craft_matrixcontent_MYMATRIXtable. craft_matrixcontent_MYMATRIX --------------------------- id | elementId | locale | field_BLOCKTYPE_FIELDHANDLE | ...
1 vote
1 answer
404 views

Craft CMS admin intermittent internal server errors

I'm getting intermittent Internal server errors in Craft admin. This has happened out of the blue on an active site. Craft pro 3.041 phperrors.log: PHP Notice: Undefined index: constraint_name in /...
1 vote
1 answer
338 views

Migrating Craft CMS 2 to 3

I have a craft CMS 2 codebase that a former developer had made for running on our PHP 5 server. Recently, the server upgraded its PHP version to 7.3 so I am trying to migrate the website to a later ...
0 votes
0 answers
321 views

Can someone help me solve for this error message: "Craft can't connect to the database with the credentials...."

Can someone help me solve for this error message: An exception has been thrown during the rendering of a template ("Craft can't connect to the database with the credentials in craft/config/db.php....
1 vote
1 answer
642 views

Can't Backup Database - "Failed with exit code 1" (WAMP Server)

I'm running Craft 3 on a local windows machine, but every time I try to update certain plugins (or Craft itself) I get a message "Couldn't back up the database. How would you like to proceed". The ...
1 vote
1 answer
44 views

how to write db-commands on custom table (PHP syntax) inside twig file?

if i have a custom table (ct_table) and i have to use MySQLi commands on it using the PHP syntax, it won't work if i put the PHP snippets inside a twig file. So are there any tools or official methods ...
2 votes
1 answer
69 views

Store phonetics in plain text field

I need to store phonetics for word definitions in a plain text field. An example would be something like "Craft Website" => \ ˈkraft ˈweb-ˌsīt \, like you'd see in a dictionary. If I try saving \ ...
0 votes
0 answers
272 views

Very slow site speed

Most pages on our large site are taking far too long to load. I have gone through and made some template changes that have been suggested, and currently have been running rebuild search index for over ...
1 vote
1 answer
80 views

Reapplying Users and Related Content to Database During Pipeline Promotion

I was on a dev ops call this afternoon and am wondering about the viability of a proposed solution for pushing changes to a Craft product through a dev pipeline. For context, this is for a big company ...
1 vote
1 answer
78 views

Craft Script: Environment variable GLOBAL_DB_DRIVER was neither 'mysql' nor 'pgsql'

I keep getting the error Environment variable GLOBAL_DB_DRIVER was neither 'mysql' nor 'pgsql'. Aborting. when trying to pull the database from the production server to staging using Craft Script. I ...
1 vote
1 answer
327 views

How do you change from MySQL 5.7 to MySQL 8 in Nitro on MacOS

I usually use Nitro and docker to run Craft. Nitro created a Docker container with MySQL 5.7. How can I change that version to MySQL 8?
1 vote
1 answer
196 views

MySQL error when sync database using Craft Script from Craft Nitro

I'm trying to sync the database from staging to local (Craft Nitro) using the craft-script as per the article. Here is the error message, Usage: mysqldump [OPTIONS] database [tables] OR mysqldump [...

1
2 3 4 5
8