Questions tagged [database]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
101
votes
8answers
14k views

What's the best practice for handling data migration and organization across development environments?

This issue becomes especially difficult when there are multiple environments, with multiple developers working on different features that affect the data structure. The holy grail is a git-style ...
33
votes
3answers
3k views

What's the best practice for upgrading a versioned Craft site?

It's thrilling to click The Button and watch Craft update itself. I take advantage of multi-site configurations with every deploy, and my practice thus far is to... Upgrade Craft in production. ...
6
votes
1answer
2k views

Move entry from one structure to another with parenting

Seeing as moving entries between sections isn't supported (yet) through the Craft interface, I followed Brandon's answer for a workaround through the database. I am moving entries from one structure ...
3
votes
1answer
974 views

Search Contact Person Plugin via Ajax

I'm new to Craft and I'm trying to achieve the following with a Craft Plugin A user visits my site and can input a zip code to receive the corresponding contact person's name, phonenumber and image. ...
11
votes
3answers
5k views

Migrating a whole website between Craft instances

A developer built our site locally configured as "craft.dev". At the same time, my sysadmin was busy getting Craft installed with Apache on our Linux server. He set that up with our real domain and ...
5
votes
1answer
5k views

Craft 3: Can't backup database ("mysqldump: command not found")

I just tried to export the DB on the Database Backup page. Unfortunately, I got an error message saying "There was a problem backing up your database. Please check the Craft logs." So I checked the ...
8
votes
1answer
1k views

Query table in a different database

I'm writing another plugin for my craft app, this time I'm attempting to reuse a MySQL table that's used by other applications as well. I've a class extending the BaseRecord, and getTableName() will ...
7
votes
2answers
2k views

craft_searchindex table keeps crashing

On my local machine, every time I've added a new field and want to add content to it for the first time I get the following error: CDbException CDbCommand failed to execute the SQL statement: ...
5
votes
1answer
732 views

Plugins: Managing Related Records

I am working on a plugin that is requiring several DB tables, some of which are relational pivot tables. This is more of a general how-to, but also best practice question on managing those ...
3
votes
2answers
6k 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 ...
6
votes
1answer
870 views

Get related entry data within a plugin (ElementCriteriaModel) without extra queries

I have the following code: $criteria = craft()->elements->getCriteria(ElementType::Entry); $criteria->section = 'submissions'; // Loop foreach ($criteria as $entry) { echo $entry->id....
3
votes
1answer
588 views

Poor performance on midsized site / Queries without index?

I'm running a mid sized website (couple hundred articles, between 30-50k visits per day) on a Digital Ocean 16GB / 8 Cores web server and I have two questions: Most of the time the website runs ...
9
votes
2answers
2k views

Installation Error "1046 No database selected"

Summary I'm getting the following error when attempting to install a new Craft site locally: CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]: Invalid catalog name: 1046 No database ...
7
votes
3answers
1k views

"Eager loading" of relations like Yii's "with" function

Is there any way to "eagerly load" Craft element relations a la Yii's ActiveRelation "with" function? http://www.yiiframework.com/doc/api/1.1/CActiveRecord#with-detail This seems like a very handy ...
4
votes
2answers
1k views

PHP Fatal error: Allowed memory size of X bytes exhausted

Getting the following when just querying the database for all records in a section (channel). There are about 75 entries. I'm getting the PHP Fatal error: Allowed memory size of 33554432 bytes ...
3
votes
1answer
547 views

Mobile app authentication

We're trying to use Craft as a CMS for a mobile app and to accomplish this we need to convert entries to JSON. We use the Element API plugin for this and it works like a charm. The problem is that ...
2
votes
1answer
2k views

Craft CMS Plugin Save Record to DB from Variable

I am tearing my hair out with this! So, I have a variable file setup as follows <?php namespace Craft; class TrackrVariable { public function startTrace() { if(!isset($_COOKIE['...
3
votes
1answer
369 views

How to export client-entered content for a specific channel to keep my local database in sync with staging

I'm in the process of developing a site for a client and I'd like to give them access to the control panel on the staging server so they can begin to enter content for their "News" channel, which is ...
3
votes
2answers
994 views

Migrations for Deployment

Currently each time we make changes to our dev instance of our Craft install (add fields, plugins, change settings in CP), we dump the database and upload it to the production database server. This ...
2
votes
1answer
2k views

Fetch values for a single field across all entries in a section

I have a section "Hotel Room" with a field "Sleeps" (number). There is no limit on the values that can be entered. On the frontend I want a list of all existing entered values for this field. So if I ...
4
votes
1answer
441 views

Database structure for Craft 3 to import from external source?

Is there any best practice how to import info Craft 3 data from external source, or should I backtrack it from the database?
3
votes
2answers
2k views

Manually clean database cache

Is it possible to manually clean the database caches for templates? Doing it from the CP becomes stuck.
2
votes
1answer
306 views

DB back-up gives syntax errors on import in new DB

I had this issue on two different sites on two different occasions and hosts. When creating a database back-up through the Craft CMS admin and importing that SQL file into a new database through PhP ...
2
votes
1answer
196 views

Relation row insertion in DB (plugin)

this is my first question on StackExchange regarding CraftCMS. Currently im working on a plugin that should insert a relation row (in db) regarding an entry and asset (image). Is there a simple ...
2
votes
1answer
588 views

Subdomain database configuration picking up root domain config

So I have this example database config setup $customDbConfig = array( '*' => array( 'tablePrefix' => 'craft', ), 'test1.foo.com' => array( 'server' => '...
1
vote
1answer
981 views

Craft 3 Database Backup

Why do I have to activate the PHP functions: "proc_open" and "proc_close" to backup the database? I got the error logs: [error][yii\base\Exception] yii\base\Exception: Could not ...
1
vote
1answer
710 views

Craft files and DB out of sync

A client's site is currently showing this message: Craft does not support backtracking to this version. Please upload Craft 2773 or later. I understand how to fix it, but I don't understand how ...
1
vote
1answer
143 views

Looking at potentially 100,000 users/entries to capture data

Looking at a small site build, but potentially capturing Names, Email and Addresses /custom fields, then dumping into a csv. There's no user activation, but any potential issues with so many entries ...
0
votes
0answers
42 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-...
0
votes
0answers
613 views

How to get GoDaddy to connect to db?

I've been trying to get a quick staging environment setup on GoDaddy all day. By using die('foo') I can tell that GoDaddy is able to reach all of my files (public/index.php, craft/config/db.php and ...
0
votes
1answer
436 views

Missing buttons in settings after update to 2.5 beta

After updating my dev install to 2.5 beta, I seem to be missing the action buttons for each tool category in the settings page, see attached image. Anyone else experienced this? This applies to all ...
0
votes
0answers
149 views

CDbException: Column not found

I created a Matrix field with 1 block type called "Logo" and 2 fields inside that: 1) a related entries field and 2) an image asset. I then created a global that has this Matrix field in it that ...
0
votes
1answer
430 views

Users not being deleted from the craft_users table?

Since upgrading to craft 2.6.2785 when I delete a user it appears to remove the user from the elements and elements_il8n tables but does not delete the user from the users table. If you then search ...
0
votes
3answers
538 views

Host a Craft app

I've just made my first craft application and I'm ready to launch it. After looking at some topics I've decided I should go with DigitalOcean and ServerPilot. I have a domain, the only thing is that I ...
0
votes
1answer
699 views

Plugin only saving one column in database

I'm having trouble saving some data into the database with my plugin. I am able to save content only if an index is defined on that column, but only if unique=>true is set, which causes some problems ...