<p>You have several options to solve this issue.</p>

<p><strong>Import fields via plugin</strong></p>

<p>You could create a plugin that handles all these function in it's installation callback so you would install the plugin and have all the things you need. But this requires basic knowledge in plugin development. </p>

<p><em>Advantage</em> When Pixel and Tonic make any changes in their install process it won't infect your code and if you are going to make multiple plugins you'll be able to import the required fields whenever you use them. That's the way we handle it and when someone installs my Form Builder Plugin it includes a form relation field to each entries with type <code>pages</code> and some crop rules automatically. </p>

<p><em>Disadvantage</em> You need to learn php</p>

<p><strong>Import via SQL</strong></p>

<p>Install a new Craft instance, insert all your default values you would like to have for a new project and export the entire database. When you start a new project you would skip the installation process but import your included database and the files of your "default" instance.</p>

<p><em>Advantage</em> This is an easy and really fast way to achieve your goal. It does not require any knowledge or skills</p>

<p><em>Disadvantage</em> You should pay attention when Pixel and Tonic makes core changes in their default structure or things could eventually break in the future (even if it is really unlikely because they are really careful with those things)</p>

<p><strong>Search for a plugin from someone else that handles it</strong></p>

<p>I know there is a <a href="https://github.com/verbb/feed-me" rel="nofollow noreferrer">Feed Me</a> Plugin maybe this does what you want but I never really used plugins that are not created in my company so I can't tell something about it</p>

CC BY-SA 3.0
2017-12-27T12:43:00.747Z
Thanks for your suggestions, Robin! I actually managed to take the "Import via SQL" route, using Sequel Pro to access the database and export **only** the `craft_assettransforms` table there. Reimported this singular table in my new project and all the transforms seem to be there. So basically I could do the same with alle the other pre-defined stuff, right? Maybe even keep those individual table dumps as Templates for new projects.
Tobias S.
CC BY-SA 3.0
2017-12-27T12:55:13.387Z
Yes that works for asset transforms. Since you said you are not familiar with SQL I did not suggest you to only import one single table because depending on the things you already included into the other system there could be errors if you don't pay attention. If your 2nd project is still empty it's all good. Most fields will work too but you need to know what you do when you want to import matrix fields because the table relations must all be correct, otherwise the entries will not populate correctly.
Robin Schambach
CC BY-SA 3.0
2017-12-27T12:58:57.277Z
And if you are going to include fields you either have to resave them or you have to create the corresponding columns in your `craft_content` table too (or include the entire table if you are going to reuse all fields). It's the same for entry types and sections. They have so called foreign key contains (so the ids must all match) that's why you need to import all those related tables or row per row really carefully. If you are going to use Craft 3 in the future it becomes even more complicated this way. That's why I suggest to import everything
Robin Schambach
CC BY-SA 3.0
2018-01-19T12:24:40.133Z
Thanks for the further details, Robin. I'll consider all this.
Tobias S.
CC BY-SA 3.0
2017-12-27T11:30:34.000Z
2017-12-27T11:38:21.023Z
2017-12-27T11:38:21.023Z
Robin Schambach
<p><em><strong>Update 2024:</strong></em> This has become redundant over the years as it is much easier to create the transforms on the Twig/template level and not use the CP image transforms setup at all.</p>

CC BY-SA 4.0
2024-09-10T12:48:31.880Z
2024-09-10T12:48:31.880Z
Tobias S.
<p>I am wondering if there is a way to re-use pre defined field types and image crops over various Craft projects. I currently in the process of e.g. manually defining 20 different image crops I already defined for another project, which is a tedious task.</p>

<p>I am not really familiar with SQL and database structures, so I am not sure if there is a way to simply copy fields from one projects database to another or if this would corrupt my database? </p>

<database><mysql><workflow><setup>
Workflow for re-using data structures and setups across projects?
# Workflow for re-using data structures and setups across projects?

(Asked by: username_0 on 2017-12-27)

I am wondering if there is a way to re-use pre defined field types and image crops over various Craft projects. I currently in the process of e.g. manually defining 20 different image crops I already defined for another project, which is a tedious task.

I am not really familiar with SQL and database structures, so I am not sure if there is a way to simply copy fields from one projects database to another or if this would corrupt my database?

**Tags:** database, mysql, workflow, setup


---

## 2 answers

### Answer by username_1 on 2017-12-27. Score: 3

You have several options to solve this issue.

**Import fields via plugin**

You could create a plugin that handles all these function in it's installation callback so you would install the plugin and have all the things you need. But this requires basic knowledge in plugin development.

*Advantage* When Pixel and Tonic make any changes in their install process it won't infect your code and if you are going to make multiple plugins you'll be able to import the required fields whenever you use them. That's the way we handle it and when someone installs my Form Builder Plugin it includes a form relation field to each entries with type `pages` and some crop rules automatically.

*Disadvantage* You need to learn php

**Import via SQL**

Install a new Craft instance, insert all your default values you would like to have for a new project and export the entire database. When you start a new project you would skip the installation process but import your included database and the files of your "default" instance.

*Advantage* This is an easy and really fast way to achieve your goal. It does not require any knowledge or skills

*Disadvantage* You should pay attention when Pixel and Tonic makes core changes in their default structure or things could eventually break in the future (even if it is really unlikely because they are really careful with those things)

**Search for a plugin from someone else that handles it**

I know there is a [Feed Me](https://github.com/verbb/feed-me) Plugin maybe this does what you want but I never really used plugins that are not created in my company so I can't tell something about it

> **Comments:**
> **username_0**: Thanks for your suggestions, Robin! I actually managed to take the "Import via SQL" route, using Sequel Pro to access the database and export **only** the `craft_assettransforms` table there. Reimported this singular table in my new project and all the transforms seem to be there. So basically I could do the same with alle the other pre-defined stuff, right? Maybe even keep those individual table dumps as Templates for new projects.  
> **username_1**: Yes that works for asset transforms. Since you said you are not familiar with SQL I did not suggest you to only import one single table because depending on the things you already included into the other system there could be errors if you don't pay attention. If your 2nd project is still empty it's all good. Most fields will work too but you need to know what you do when you want to import matrix fields because the table relations must all be correct, otherwise the entries will not populate correctly.  
> **username_1**: And if you are going to include fields you either have to resave them or you have to create the corresponding columns in your `craft_content` table too (or include the entire table if you are going to reuse all fields). It's the same for entry types and sections. They have so called foreign key contains (so the ids must all match) that's why you need to import all those related tables or row per row really carefully. If you are going to use Craft 3 in the future it becomes even more complicated this way. That's why I suggest to import everything  
> **username_0**: Thanks for the further details, Robin. I'll consider all this.  

---

### Answer by username_0 on 2024-09-10. Score: 1

***Update 2024:*** This has become redundant over the years as it is much easier to create the transforms on the Twig/template level and not use the CP image transforms setup at all.


---

