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. ...
12
votes
1answer
594 views

How to profile Craft CMS

I would like to turn on a profiler in Craft CMS so I can see what DB queries are being run and how long they take. Is this possible?
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 ...
9
votes
5answers
2k views

Is there a way to delete all entries in a section?

I've ended up with loads of duplicate entries after a botched import job. Is there an easy and safe way to delete all entries in a section, so that I can start over again?
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 ...
8
votes
1answer
1k views

Manual update without database backup

I’m trying to update Craft Pro 2.0.2543 to the latest build but the site’s database is in excess of 2Gb. When hitting ‘Finish up’ in the CP after a manual update, by the time the database has backed ...
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
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 ...
7
votes
2answers
3k views

Export database from control panel or Sequel Pro? What's the difference?

Since I am involved in a multi-developer, version-controlled setup, I do a lot of database importing and exporting from environments. I notice today that when I export a database from one of our ...
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: ...
7
votes
1answer
3k views

Craft install stuck on "Oops" screen [duplicate]

I've uploaded the files, verified permissions and set up the database. When I run the install, I see the monkey, and I enter in my details. It appears to go well, until a screen showing only: "...
6
votes
1answer
4k views

Cannot connect to database with credentials provided in db.php

I'm trying to push a site live today and am running into a problem I'm having trouble solving. I have a staging site which is a subdomain on the live server and everything works fine there but when I ...
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 ...
6
votes
1answer
428 views

How many entries could the Craft database hold before it slows down?

I'm pulling in some RSS feeds using Feed Me (https://github.com/engram-design/FeedMe) and turning those in entries automatically using a cron job. You can imagine that producing a lot of entries over ...
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....
5
votes
2answers
1k views

Using a plugin, how can I manipulate entry data?

I am trying to develop a plugin and what I want to do in this plugin is to be able to access the contents table that is already defined in the database and get and update entries in this table. What ...
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 ...
5
votes
1answer
2k views

Does Craft Support MariaDB?

I am hoping craft supports MariaDB. Also, since version 10, InnoDB transaction engine in MariaDB has been replaced with XtraDB. Will this work with Craft?
5
votes
1answer
307 views

Is it safe to mass delete users from the database directly

We have a client site that has been getting a lot of spam registrations. We're turning on purgePendingUsersDuration to help deal with some of these automatically, but I was planning to go into the ...
5
votes
1answer
1k views

How to clear the database of unused fields?

I have one section with different entry types. One entry type uses two matrix fields, another one only one, and so on. Since the frontend layout is always the same, I use one template for the whole ...
5
votes
1answer
212 views

Good practice to "Clear Caches" before you "Backup Database"?

Every time I create a database backup, I find myself instinctively clearing the cache first. My gut tells me that any cached data would be unnecessarily included in the export. Is this helpful, or am ...
5
votes
1answer
171 views

Many entry fields, only one db request?

Craft 101: I have entries with many different fields, so I'm doing something like this: {% set var = craft.entries.section('foo').slug('bar').first() %} {% if var %} {{ var.field1 }} {{ var....
5
votes
1answer
198 views

DB Update Trigger

When there are updates to Craft, I perform them locally against a local database. The files are then committed to a repository. I then use Capistrano to deploy the updated installation to various ...
5
votes
1answer
1k views

Returning specific fields with elementCriteriaModel

I'm writing a plugin that adds or updates users profiles in Craft from a JSON file. Every user profile could have a lot of custom fields in the future which store a lot of data. To check if a user ...
5
votes
1answer
879 views

How to create a migration for the main Craft DB?

Let's say we add a section or other elements (field, category, tags, assets, etc) in the CP on our dev servers and want to roll that change out to a stage or production environment, is there a way to ...
5
votes
2answers
330 views

Deleted Locale, Entries all gone now

I deleted a locale and checked to transfer all its contents to a different locale, but now the other locale still shows no entries. I'm sure all the entries are still in the database. Any help?
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 ...
5
votes
1answer
233 views

How could I make related entries load faster?

I need to show a list of users (around 400). No problem, the list loads in 1.5s, for which I could use {% cache %} to speed it up. Now, the problem arises whenever I want to display the title of an ...
4
votes
2answers
1k views

Query only returning 100 records at a time?

I am trying to export data from a database to a csv file, I am using the code below to retrieve the data from the DB, but it only returns 100 rows, how can I fix that? $criteria = craft()->...
4
votes
3answers
2k views

How can I use multi-environment configuration to set each root URL?

I'm building www.mynewcraftsite.com.au, but I also wanna create www.mynewcraftsite.dev which is a testing server to preview to my clients. I've heard that I can set this up with Craft without going ...
4
votes
1answer
2k views

Craft 3: Get Data from a custom Table via createCommand()

In Craft 2 you could creat a query with: craft()->db->createCommand()->select() .... etc. But in Craft 3 there is no select() Method in Craft::$app->db->createCommand(). Am I ...
4
votes
2answers
692 views

Self-hosting requirements/scaling

Is there any reason the mySQL, CraftCMS, and assets/images/content can't all live on the same server, assuming the server is appropriately sized and backed up? Are there any sizing/scaling guidelines?...
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 ...
4
votes
1answer
386 views

Many db requests with relationship fields

I have a page with a lot of entries fields. They are awesome but that leads also to a LOT of db requests. Aside from caching are there some best practices to lower db requests on entries fields? For ...
4
votes
1answer
1k views

Models v Records - confused

If a Model can be used to save entries, what is a Record for? Is it literally just to define the schema? I've seen a few examples where the defineAttributes methods have duplication of code too, so I'...
4
votes
2answers
3k views

How do I create database tables for a craft cms plugin on install?

I am absolutely new to craft plugin development and could not find any documentation on creating database tables specific to a new plugin. How are new tables created when a plugin is installed? I am ...
4
votes
2answers
2k views

Deploying CraftCMS to Digital Ocean

Currently I'm having an issue deploying to Digital Ocean and would love some advice, i've followed numerous tutorials but they seem to just drop off half way through the process so just need some ...
4
votes
2answers
713 views

MSSQL Support for Craft?

Is there a MSSQL support for Craft CMS? Or any plugin that can help to connect to a MSSQL database? Thank you!
4
votes
1answer
168 views

Moving to another database: "Specified key was too long"

I am attempting to move the database from my local machine running MySQL 5.5.38 to my webhost running 5.1.70. However when I do so I get the following error on at least two tables. I am using a MySQL ...
4
votes
1answer
2k views

When does Craft change or delete template caches?

My question is regarding template caching in Craft. I want to know when does Craft actually change the cache or delete old cache. Let's say that I am caching a chunk that just displays the entry ...
4
votes
2answers
1k views

"Craft CMS does not support backtracking to this version. Please upload Craft CMS 0 or later."

I have a problem related this and this question. I began updating a long time ago (2017?) and got the error "Craft CMS does not support backtracking to this version. Please upload Craft CMS 0 or later"...
4
votes
1answer
597 views

Incorporating data from an external database into Craft pages

I'm looking at how best to incorporate various sets of data from another MySQL database into a Craft site. Using the Feed Me plugin would be one way, if the data source had feeds, but I'm thinking ...
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?
4
votes
1answer
1k views

Craft CMS Database Structure and Schema Schematics

Is there somewhere that we can find a the schematics of crafts database structure/schema. We are looking into developing a database migration workflow between development and production environments. ...
4
votes
1answer
1k views

Complex custom SQL query with multiple relationships (Craft DB)

For the Sprout Reports plugin I need to write a custom SQL query to get some Craft data. (We use this plugin so our client can easily generate CSV exports at any time from the CP). As there are ...
3
votes
4answers
2k views

Populating craft database from non-craft data

Is it possible to populate the Craft content database table with entries from a non-craft database (which isn't a live database, it's a local copy). I've set up my channels etc for the incoming data ...
3
votes
2answers
1k views

Why am I getting only one result with "craft()->db->createCommand()"?

Why am I getting only one result with the following query? $query = craft()->db->createCommand(); $entryRecord = $query->select('craft_content.field_releaseDate, craft_content.title, ...
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 ...
3
votes
3answers
1k views

Craft 3 cannot find mysqldump command, console works

I want to use Feed Me with Craft to import my old database, but neither Feed Me nor Craft can find mysqldump. I know this is a known problem, and I have successfully added the path to $PATH and ...

1
2 3 4 5
7