From bb276b3f2e6b317119fdfb5136c39d943bd054fd Mon Sep 17 00:00:00 2001 From: Robson Ventura Rodrigues Date: Mon, 22 Apr 2024 14:21:51 -0300 Subject: [PATCH] Minor documentation improvements --- client/README.md | 4 +++- server/README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/client/README.md b/client/README.md index d1ee58f..a456b1b 100755 --- a/client/README.md +++ b/client/README.md @@ -1 +1,3 @@ -# Planka client +# Frontend + +The Planka frontend uses a combination of React, Redux, and Saga for state management and side effects, providing a rich and responsive user experience. diff --git a/server/README.md b/server/README.md index 26e62b8..75658ac 100644 --- a/server/README.md +++ b/server/README.md @@ -1 +1,53 @@ -# Planka server +# Planka Server Documentation + +The backend was developed using the SailsJS framework, which facilitates complex operations in web applications, especially when combined with the Knex database migration manager. + +## Modifying the Database Structure + +### Creating a Migration + +**Step 1:** Navigate to the corresponding folder within the project: +```bash +cd ROOT_PATH/server/db +``` + +**Step 2:** Execute the following command to create a new migration file: +```bash +npm run db:create-migration add_change_in_the_database_structure +``` + +This command creates a file in the migration folder named based on the provided argument. The generated file will have the following initial structure: +```Javascript +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.up = function(knex) { + // Add the changes that will be applied to the database +}; + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.down = function(knex) { + // Add the changes that will revert the operations done in up +}; +``` + +#### Adapting to Asynchronous Functions: +In the project, asynchronous functions are used by default. Modify the migration file to adhere to this standard: + +```Javascript +exports.up = async (knex) => { + // Migration logic to apply changes +}; + +exports.down = async (knex) => { + // Migration logic to revert changes +}; +``` + +#### Implementation +Implement the necessary logic in the up and down methods to apply or revert changes in the database. To understand how migrations work and explore detailed examples, refer to the [official Knex documentation on migrations](https://knexjs.org/guide/migrations.html#migration-api). +