Skip to main content

Questions tagged [database]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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 ...
jishi's user avatar
  • 273
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-...
flip's user avatar
  • 149
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 ...
Zico123's user avatar
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 ...
Michael Yaeger's user avatar
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 ...
m_andrasch's user avatar
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 ...
Matthias Redl-Mann's user avatar
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 ...
buck1112's user avatar
  • 400
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 ...
kmgdev's user avatar
  • 1,199
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 ...
Jaytrix's user avatar
  • 337
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). ...
Jaytrix's user avatar
  • 337
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 ...
KSPR's user avatar
  • 3,786
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 ...
H.W. Sanden's user avatar
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 ...
wdesign's user avatar
  • 11
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 ...
Sam St Aubyn's user avatar
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 ...
Sapphireblue's user avatar
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 ...
emilie zawadzki's user avatar
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 ...
Cole Henley's user avatar
  • 1,741
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 ...
Sandro's user avatar
  • 53
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 ...
SeanJ's user avatar
  • 21
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, ...
taylor018's user avatar
  • 103
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 ...
Kyle Lambert's user avatar
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 ...
Market South's user avatar
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. ...
loliki's user avatar
  • 151
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 ...
John's user avatar
  • 73
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 ...
Martin's user avatar
  • 43
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 ...
cballenar's user avatar
  • 1,409
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. ...
Henrik's user avatar
  • 425
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 ...
Emma Swann's user avatar
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 ...
blnkt's user avatar
  • 21
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 ...
Edoardo Stefani's user avatar
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 /...
Graham Bennett's user avatar
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 ...
Joseph D's user avatar
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....
Cait H.'s user avatar
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 ...
Ra3d K's user avatar
  • 125
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 ...
Emma Swann's user avatar
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 ...
Christopher Spence's user avatar
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 ...
Lee's user avatar
  • 139
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, ...
Lars Woehning's user avatar
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?
EdisonJS's user avatar
0 votes
0 answers
98 views

SQL Queries Performing Full Table Scan

Per the title, our application's db query has from time to time pegged our CPU to the max and taken down the site. Our site has gotten quite large in terms of content and trying to figure out how best ...
zhua89's user avatar
  • 31
0 votes
0 answers
30 views

Adding A Soft Delete in Craft 2 Entries

I've been thinking of adding a "Soft Delete" or just perhaps a means in which deleting in certain sections (e.g. News) will archive the entry with an update, rather than deleting it. As I ...
buck1112's user avatar
  • 400
0 votes
0 answers
177 views

Certain Queries Pegging CPU and Causing Production Site to go Down

I read these two posts MySQL CPU pegged on specific query Poor performance on midsized site / Queries without index? and and am in a similar situation although for us it actually breaks our site and ...
zhua89's user avatar
  • 31
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 [...
Lee's user avatar
  • 139
0 votes
0 answers
59 views

SyncDB with Nitro Fail to sync database from local to staging

I'm trying to sync the database for my local Craft Nitro to the staging environment using SyncDB. Here is the error, [2021-06-04T15:49:51.623536+08:00] sync.NOTICE: Starting database sync [] [] [2021-...
Lee's user avatar
  • 139
1 vote
2 answers
389 views

Unable to backup the database or apply migrations

I'm running CraftCMS via 3 Docker containers in 1 Docker network: Container 1 - MySQL Container 2 - Nginx Container 3 - PHP:7.4-fpm When I run php craft update craft from container 3 and choose to ...
studio-pj's user avatar
  • 111
0 votes
0 answers
266 views

When Using Nitro Add and it gets to the choose database engine question, the choices arent there and typing in doesn't work

I'm totally new at craft cms and nitro and I'm having trouble adding a new site. When I get to the part where it asks you which database engine to use there's no options there to choose from and ...
Claire Browne's user avatar
1 vote
2 answers
341 views

Synching content and template files across environments

I'm new to CraftCMS and have a few basic questions about synching contents between local and remote development environments. This has been discussed in other posts by I'm looking for more specific ...
mauricio's user avatar
  • 187
1 vote
1 answer
58 views

Why does the matrix field produce such a massive amount of duplicate information?

The matrix field in Craft CMS is producing massive quantities of duplicate data. About 70 database rows per entry. Is there something I'm doing wrong? I don't think this will be sustainable for my ...
Akuden 's user avatar
1 vote
0 answers
78 views

Building a yii query for Connect plugin

I'm using the Connect plugin by Andrew Welch to get some data from an external database. Somewhere in the data, I need data from another related table. The way I'm doing this now is like this: {% set ...
Bart Rylant's user avatar
1 vote
0 answers
277 views

Craft warning: Tried to release a savepoint, but it does not exist

I'm working on a plug-in for Craft 3. For this plug-in is a migration is needed. When this migration runs and adds the entries, fields, and groups then the following warning occurs in the logs. [...
randomGuy's user avatar

1
2 3 4 5
8