Questions tagged [database]
The database tag has no usage guidance.
370
questions
1
vote
1
answer
18
views
Using a custom CRAFT_DB_DATABASE value at DDEV startup
When DDEV starts, it writes some variables about the db settings in the .env file:
# Database connection settings
CRAFT_DB_DRIVER="mysql"
CRAFT_DB_SERVER="db"
CRAFT_DB_PORT="...
1
vote
1
answer
44
views
Looking for best practices deploying to Azure Web App
I have a client who is requiring me to move a production site into his Azure environment, and rather than just making a VM available to me, he's provided me with a Web App with a PHP runtime. I'm not ...
0
votes
0
answers
32
views
Reduce Unnecessary Database Entries in Craft CMS After Changing Propagation Settings
In one of our Craft CMS projects, we have accumulated around 100 subsites over the years. This has resulted in a large number of unnecessary database entries due to incorrect propagation settings. Our ...
0
votes
0
answers
84
views
Can't convince Project Config to make new fields on production
I am trying to troubleshoot a problem with Project Config updates not fully working when applied to my production site.
I am running a simple Git workflow: local Dev site -> git -> live ...
1
vote
1
answer
86
views
Baffled by connection issue
I have a client with a Craft 4 site on GoDaddy. I’m not thrilled with the hosting, but it has been working fine for months/years.
Suddenly, it’s showing an internal server error message on the front-...
1
vote
1
answer
67
views
Craft 5 Update: Database Views for Content Table No Longer Functioning
I have a custom module on my Craft CMS site that uses a database view by joining the content table and user table. This view consolidates all user details into one place. However, with the Craft CMS 5 ...
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
63
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
40
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 ...
1
vote
1
answer
54
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
48
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
115
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
30
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
300
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
84
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
84
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
202
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
53
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
361
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
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
394
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
34
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
79
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
173
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
138
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
800
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
448
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
139
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
364
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
250
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
755
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
641
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
52
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
95
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 ...
1
vote
1
answer
424
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
364
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
341
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
45
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
286
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
81
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
182
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
332
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
104
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
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 ...
0
votes
0
answers
183
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
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 [...
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-...