Questions tagged [database]
The database tag has no usage guidance.
360
questions
1
vote
1
answer
32
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
21
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
60
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
34
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 ...
0
votes
0
answers
60
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
108
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 ...
2
votes
1
answer
40
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
73
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 ...
1
vote
0
answers
20
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
206
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
30
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
58
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
0
answers
175
views
Craft CMS + Docker Deployment Strategy
We are about to move to a new development and hosting environment (I am also new to Craft). Our planned development workflow is as follows: develop and test on a local craft cms docker container ...
0
votes
1
answer
119
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 ...
1
vote
1
answer
98
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 ...
0
votes
1
answer
510
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
1k
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
326
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
110
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.
...
1
vote
1
answer
260
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 ...
0
votes
0
answers
119
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
571
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
496
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
47
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
76
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
47
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 ...
1
vote
1
answer
354
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
278
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
262
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
40
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 ...
0
votes
0
answers
249
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
73
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
76
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
140
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
300
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?
0
votes
0
answers
83
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 ...
0
votes
0
answers
29
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 ...
0
votes
0
answers
148
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 ...
1
vote
1
answer
186
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 [...
0
votes
0
answers
58
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-...
1
vote
2
answers
340
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 ...
0
votes
0
answers
264
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 ...
1
vote
2
answers
239
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 ...
1
vote
1
answer
47
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 ...
1
vote
0
answers
71
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 ...
1
vote
0
answers
265
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.
[...
2
votes
1
answer
90
views
How to keep staging install synced with member registration
What is the best way to keep live and staging environments synced with member registrations?
I can export/import the database from the live to staging environment to keep it in sync - and have a ...
1
vote
1
answer
184
views
Use Emoji in Title?
I need to be able to store emoji in the title field of several entries, but whenever the entry is saved the emoji characters are stripped out and replaced with four question marks i.e. ????.
I imagine ...
1
vote
0
answers
97
views
Very slow `INSERT` transactions on the resourcepaths table
After a recent update (Craft 3.4.x to 3.5.x) I'm seeing some suspiciously slow response times in relation to INSERT actions on the resourcepaths table. Some in the upwards of a half second for a ...
2
votes
3
answers
369
views
Deleting user data from the database
I'm using Craft 3.6.4.1 and I need to delete a whole tranche of users from the database (that has derived from another Craft instance).
I've been deleting by hand via the CMS but note that loads of ...