# Code to create table automatically in database when activating custom plugin.

**URL:** https://forum.mautic.org/t/code-to-create-table-automatically-in-database-when-activating-custom-plugin/9431
**Category:** Product Support
**Created:** [September 13, 2017, 6:04am UTC](https://forum.mautic.org/t/code-to-create-table-automatically-in-database-when-activating-custom-plugin/9431 "2017-09-13T06:04:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![webdev](https://avatars.discourse-cdn.com/v4/letter/w/b2d939/32.png) [@webdev](https://forum.mautic.org/u/webdev)
#### Post date: [September 13, 2017, 6:04am UTC](https://forum.mautic.org/t/code-to-create-table-automatically-in-database-when-activating-custom-plugin/9431/1 "2017-09-13T06:04:48Z")

</div>

I have a custom plugin and I want to know how to achieve this when I will activate a plugin it should create a table automatically in the database.  
  
Any help would be great.  
  
Thanks in advance.

---

<div class="post-metadata">

### Author: ![webdev](https://avatars.discourse-cdn.com/v4/letter/w/b2d939/32.png) [@webdev](https://forum.mautic.org/u/webdev)
#### Post date: [September 13, 2017, 6:04am UTC](https://forum.mautic.org/t/code-to-create-table-automatically-in-database-when-activating-custom-plugin/9431/2 "2017-09-13T06:04:48Z")

</div>

I have a custom plugin and I want to know how to achieve this when I will activate a plugin it should create a table automatically in the database.  
Any help would be great.  
Thanks in advance.

---

<div class="post-metadata">

### Author: ![ferdinandog](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ferdinandog/32/637_2.png) [@ferdinandog](https://forum.mautic.org/u/ferdinandog)
#### Post date: [November 15, 2021, 10:16am UTC](https://forum.mautic.org/t/code-to-create-table-automatically-in-database-when-activating-custom-plugin/9431/3 "2021-11-15T10:16:53Z")

</div>

Hi, did you then understand how to create tables from plugin entities?
