From 2b40272774c15fde2ea934b89bfed5c01e2ded3b Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Sat, 24 Aug 2019 19:04:00 +0200 Subject: [PATCH] Explain how tables and columns are named in the docs --- docs/content/en/docs/Using SQL/custom_queries.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/content/en/docs/Using SQL/custom_queries.md b/docs/content/en/docs/Using SQL/custom_queries.md index 6ced9115..d918ffc5 100644 --- a/docs/content/en/docs/Using SQL/custom_queries.md +++ b/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