Creating a Table
Last updated
Was this helpful?
Last updated
Was this helpful?
Name your table in plural form.
Be careful of your indices and primary keys. Maybe a composite primary key is more useful.
There is no need to add a maximum length to strings.
Make use of .references('table_name.foreign_key')
when defining relationships.
Make use of timestamps for boolean fields.
Make sure you add references to organization ID or account ID where needed.
Avoid using UUID v4s for your Primary Keys. Consider UUID v1/v7, ULID, or normal Big Int.