Skip to content
Permalink
Browse files

Explain how tables and columns are named in the docs

  • Loading branch information...
simolus3 committed Aug 24, 2019
1 parent ca76746 commit 2b40272774c15fde2ea934b89bfed5c01e2ded3b
Showing with 9 additions and 0 deletions.
  1. +9 −0 docs/content/en/docs/Using SQL/custom_queries.md
@@ -39,6 +39,15 @@ Queries can have parameters in them by using the `?` or `:name` syntax. When you
moor will figure out an appropriate type for them and include them in the generated methods. For instance,
`'categoryById': 'SELECT * FROM categories WHERE id = :id'` will generate the method `categoryById(int id)`.

{{% alert title="On table names" color="info" %}}
To use this feature, it's helpful to know how Dart tables are named in sql. For tables that don't
override `tableName`, the name in sql will be the `snake_case` of the class name. So a Dart table
called `Categories` will be named `categories`, a table called `UserAddressInformation` would be
called `user_address_information`. The same rule applies to column getters without an explicit name.
Tables and columns declared in [SQL tables]({{< relref "custom_tables.md" >}}) will always have the
name you specified.
{{% /alert %}}

You can also use `UPDATE` or `DELETE` statements here. Of course, this feature is also available for
[daos]({{< relref "../Advanced Features/daos.md" >}}),
and it perfectly integrates with auto-updating streams by analyzing what tables you're reading from or

0 comments on commit 2b40272

Please sign in to comment.
You can’t perform that action at this time.