> For the complete documentation index, see [llms.txt](https://docs.novel.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.novel.dev/guides/knowledge-base/database/creating-a-table.md).

# Creating a Table

{% embed url="<https://knexjs.org/guide/schema-builder.html>" %}

## Best Practices

* 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.
