Answers.Body: <p>I was looking for an answer to this myself and found <a href="https://craftcms.stackexchange.com/questions/27164/running-module-migrations">Running module migrations</a></p>
  <p>It is basically saying you can only create the tables as part of your craft project - but not specific to your module. To create this project-wide migration run in your craft project folder (not your module folder):</p>
  <pre><code>php craft migrate/create [my_migration_name]
  </code></pre>
  <p>This will create the migration file and class in your craft's projects 'migrations' folder (it will display the exact path and file name after running the above command). For more info about the Migration class see <a href="https://craftcms.com/docs/3.x/extend/migrations.html#creating-migrations" rel="nofollow noreferrer">https://craftcms.com/docs/3.x/extend/migrations.html#creating-migrations</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-25T00:31:44.553Z
Answers.LastActivityDate: 2020-08-25T00:31:44.553Z
Answers.UserDisplayName: Oliver Maerz
Body: <p>Is it possible to create new tables in Craft when building custom modules or do you need to build a plugin for this?</p>
  <p>Modules don't have the special &quot;install&quot; migration. So how does table creation work for modules? Is there a best practice for creating new tables for custom modules?</p>
  
Tags: <modules>
Title: Create new tables with a custom module
ThreadText: # Create new tables with a custom module
  
  (Asked by: username_0 on 2020-07-29)
  
  Is it possible to create new tables in Craft when building custom modules or do you need to build a plugin for this?
  
  Modules don't have the special "install" migration. So how does table creation work for modules? Is there a best practice for creating new tables for custom modules?
  
  **Tags:** modules
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-08-25. Score: 1
  
  I was looking for an answer to this myself and found [Running module migrations](https://craftcms.stackexchange.com/questions/27164/running-module-migrations)
  
  It is basically saying you can only create the tables as part of your craft project - but not specific to your module. To create this project-wide migration run in your craft project folder (not your module folder):
  
  ```
  php craft migrate/create [my_migration_name]
  
  ```
  
  This will create the migration file and class in your craft's projects 'migrations' folder (it will display the exact path and file name after running the above command). For more info about the Migration class see <https://craftcms.com/docs/3.x/extend/migrations.html#creating-migrations>
  
  
  ---
  
  