active: If true, sync is performed; if false, sync is not performed. (default is false)
about sync
If sync’s active is true, sync is performed.
sync is a function to synchronize schema and MySQL.
From the SQL below, assume that the generated schema.ts already exists.
The following schema was generated based on it.
However, assume that the status is manually changed to allow only undone, in_progress and done.
After this you want to add columns to the table and generate a new schema.
At this time, if sync’s active is false, it will generate a completely new schema.
Therefore, the status will revert to z.string().
If sync is enabled, the already existing schema will remain in place.
If there are newly added columns, they will be added to the existing schema as follows
By enabling sync, you can always keep the schema up-to-date.
As a precaution, any description in the schema.ts file will be deleted when the schema is regenerated.
We recommend that you write your own schema, auxiliary functions, etc. in a separate file.