You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
planka_custom/server
Robson Ventura Rodrigues bb276b3f2e Minor documentation improvements 2 years ago
..
api Added card archiving functionality and created status column with corresponding migrations 2 years ago
config feat: Slack bot notifications (#676) 2 years ago
db Added card archiving functionality and created status column with corresponding migrations 2 years ago
private/attachments feat: Remove attachments from public access 4 years ago
public feat: Remove attachments from public access 4 years ago
test feat: Modify logger to log to file that supports fail2ban (#284) 3 years ago
utils feat: Labels reordering 3 years ago
views Docker, update readme, update dependencies 6 years ago
.editorconfig Initial commit 6 years ago
.env.sample feat: Slack bot notifications (#676) 2 years ago
.eslintignore ref: Ignore public js linting (#278) 3 years ago
.gitignore meta: Fix ignore files for logs 3 years ago
.npmrc Update server scaffold 6 years ago
.sailsrc Docker, update readme, update dependencies 6 years ago
README.md Minor documentation improvements 2 years ago
app.js feat: Add gallery for attachments 4 years ago
get-config.js feat: Add gallery for attachments 4 years ago
package-lock.json feat: SMTP integration and email notifications (#631) 2 years ago
package.json Added card archiving functionality and created status column with corresponding migrations 2 years ago

README.md

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:

cd ROOT_PATH/server/db

Step 2: Execute the following command to create a new migration file:

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:

/**
 * @param { import("knex").Knex } knex
 * @returns { Promise<void> }
 */
exports.up = function(knex) {
  // Add the changes that will be applied to the database
};

/**
 * @param { import("knex").Knex } knex
 * @returns { Promise<void> }
 */
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:

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.