Table Synchronization
Syncing tables involves the process of creating tables from models and saving them to a database. After defining your tables, you will need to synchronize your database tables using the sync method or the connect_and_sync.
The
syncandconnect_and_syncmethod accepts the following arguments:
Argument |
Description |
Type |
Default |
|---|---|---|---|
|
A collection or a single instance(s) of your table classes that inherit from the |
|
|
|
Whether to drop tables during syncing or not. |
|
|
|
Forcefully drop tables during syncing. In mysql this will temporarily disable foreign key checks when dropping the tables. |
|
|
|
Alter tables instead of dropping them during syncing or not. |
|
|
Tip
🥇 We recommend you to use drop or force if you are going to change or modify foreign and primary keys. This is because setting the option alter does not have an effect on primary key columns.