diff --git a/versioned_docs/version-2.2.1/learn/beginner/crud-application.md b/versioned_docs/version-2.2.1/learn/beginner/crud-application.md index c24ee026ec..f5e12ed8e1 100644 --- a/versioned_docs/version-2.2.1/learn/beginner/crud-application.md +++ b/versioned_docs/version-2.2.1/learn/beginner/crud-application.md @@ -49,7 +49,7 @@ For the Todo API, we need two tables, Users and Todos, let's edit the migrations To create the users table, navigate to the `db/migrations` directory and edit `001.do.sql` file, and add the schema below: ```sql -CREATE TABLE IF NOT EXISTS User ( +CREATE TABLE IF NOT EXISTS Users ( id INTEGER PRIMARY KEY, username TEXT NOT NULL UNIQUE, password TEXT NOT NULL, @@ -60,13 +60,16 @@ CREATE TABLE IF NOT EXISTS User ( And let's edit the `migrations/001.undo.sql` file to look like this: ```sql -DROP TABLE User; +DROP TABLE Users; ``` +:::note +To ensure the OpenAPI specification accurately reflects your API endpoints, it's essential to use plural table names. +::: Before we apply the migrations, let's create a new table for our Todos, to do that create another file `002.do.sql` and inside it, add the schema for your Todos table. ```sql -CREATE TABLE IF NOT EXISTS Todo ( +CREATE TABLE IF NOT EXISTS Todos ( id INTEGER PRIMARY KEY, user_id INTEGER, title TEXT NOT NULL, @@ -79,7 +82,7 @@ CREATE TABLE IF NOT EXISTS Todo ( And again, add a new file `002.undo.sql` to drop the table. ```sql -DROP TABLE Todo; +DROP TABLE Todos; ``` :::note @@ -118,4 +121,4 @@ You should get a **200 OK** status code for a successful request. ## Conclusion -Congratulations! You have successfully created a simple Todo API using Platformatic. This tutorial covered the basics of setting up a Platformatic project, defining a schema, configuring the service, and creating API endpoints. For more advanced features and configurations, refer to the [Platformatic API Documentation](../../cli.md). \ No newline at end of file +Congratulations! You have successfully created a simple Todo API using Platformatic. This tutorial covered the basics of setting up a Platformatic project, defining a schema, configuring the service, and creating API endpoints. For more advanced features and configurations, refer to the [Platformatic API Documentation](../../cli.md). diff --git a/versioned_docs/version-2.2.1/learn/images/plt-endpoints.png b/versioned_docs/version-2.2.1/learn/images/plt-endpoints.png index cac5f01cdb..edaf119c5d 100644 Binary files a/versioned_docs/version-2.2.1/learn/images/plt-endpoints.png and b/versioned_docs/version-2.2.1/learn/images/plt-endpoints.png differ