5

Craft uses a fairly typical relational model, where most1 custom fields have a single column in the content table, set to an appropriate column type chosen by the field type. Unlike EAV, which crams all data into a fixed schema, Craft’s schema will change over time based on the custom fields you’ve configured. There are both performance and storage benefits ...


3

You're not misunderstanding anything, and your concerns are perfectly valid. I feel like many developers using Craft do not realise that .one() and .all() are in fact database calls, and pretty expensive ones at that. Do it your way, watch the number of DB queries go down in the debug toolbar and feel all warm and fuzzy. (Also, you don't need parentheses in ...


2

I believe you can use getLastInsertID to fetch the ID: Craft::$app->db->getLastInsertID();


2

It looks like Craft is trying to delete a database field that has already been removed. I have no idea how you ended up in this situation but here's what I'd try to resolve the issue: first backup your database, in case something goes wrong! then execute the following command on your server, in the project directory. After each command, try removing you ...


2

After executing: craft migrate/up --type=app it works again.


2

After deleting the users from the UI they are only soft-deleted. If you look at the user id and find the matching element in your elements table, you will see that this element has a populated dateDeleted. Run garbage collection (./craft gc) to clean up and completely remove everything.


1

You could also use your general config file to set the softDeleteDuration to a very low value, so that soft deleted elements get garbagecollected quickly: 'softDeleteDuration' => 300, // 5 Mins or if you're up to the command line, use ./craft gc --delete-all-trashed to immediately hard delete all soft deleted items


1

Is there a Craft recommended approach to this issue please? The simplest solution would be to update to Craft 3.5+ Template cache data went from being stored in the database to the file system, so this won't be an issue for you anymore.


1

Try manually forcing garbage collection after you've trashed all your entries in the CP. Using the cli, run ./craft gc


1

"Personally I'd just use the 'select all' checkbox at the top of entries and delete them all at once." That's what I've been doing - deleting all entries in the system. I've always thought that by deleting entries in the system it would clean the database. But when looking in the database there is so much information that is still saved even though ...


1

I restarted my DB server and it fixed the issue. Sorry for the false alarm, but I've never seen something like that before. Should have tried the DB restart before.


1

The database backup from Craft is slightly different to the SQL export in phpMyAdmin. Craft’s export (presumably) assumes you’re going to want to import that data into an existing site, whereas phpMyAdmin’s default (presumably) assumes you’ll want to import it into an empty database. However you can do exactly as you suggest — export from phpMyAdmin locally, ...


1

I'm not sure why you would do two different servers. Your front end can be cached with Blitz / NGINX which will take a load off the server and admin. How often are you aggregating the data? I've just imported 10k records from a source and I would recommend writing your own module to handle the imports as commands. From there you could set up a cron which ...


1

I'll answer this for the benefit of anyone else attempting the same thing i.e. sizeable Craft 2 to 3 migration, while you still have the Craft 2 site live. Ultimately, I chose content migrations and chose to basically ignore the projectConfig functionality for the most part during development. Since I originally asked the question projectConfig changed a bit ...


1

there should be execute() fn at the last to execute the sql query craft()->db->createCommand() ->insert('mytablename', array( 'field1' => 'foo', 'field2' => 'bar' )) ->execute();


1

This happens when you go from old craft versions, in the latest versions you have to have the config/db.php file like this: <?php use craft\helpers\App; return [ 'dsn' => App::env('DB_DSN') ?: null, 'driver' => App::env('DB_DRIVER'), 'server' => App::env('DB_SERVER'), 'port' => App::env('DB_PORT'), 'database' => App::...


Only top voted, non community-wiki answers of a minimum length are eligible