# MAYS CLI

This CLI tool provides several functions to manage and maintain MAYS projects. Below are the available commands and their descriptions. All functions are called by replacing the camelCase function name and joining it with a colon :.

For example:

  • createProject becomes create:project
  • dbMigrate becomes db:migrate

# create:project

Initializes a new project by copying the mays-backend, mays-frontend, and template-www folders into the project directory. It then calls the init function to create the .env file and imports the database boilerplate (documents/boilerplate.sql) into the new project's database. All folders must be in the same parent directory.

Before running this command, composer install must be executed inside the mays-backend folder.

The specified project name/folder asked during the command execution is relative to the parent directory of the mays-cli script.

This command also performs a git pull on the three required folders before copying, runs composer install, and installs necessary npm dependencies.

# init

Creates the .env file for the new project and generates a new token.

# validate

Validates the metadata rules.

# db:migrate

Uses the JSON files in the api/meta folder to generate and execute the necessary migrations and SQL commands for the meta configuration to function correctly. All executed commands are saved in the update.sql file for easy DB updates.

Available Parameters:

  • --no-save: Prevents saving the generated queries to the update.sql file.
  • --seed: Automatically seeds the permissions table for newly created schemas.
  • --all: Tries to check updates in all schemas not only custom ones (above 99).
  • --schema=X: Where X is the schema ID, tries to detect changes only on a specific schema.

# seed:permissions

Populates the permissions table with all permissions for all schemas, assigning them to user profiles 1 (superadmin) and 2 (admin) based on the permissions defined in the permissions field of the schema metadata.

This process only creates missing values. If permissions are updated in the meta files after seeding, no changes will be made.

# create:page

Creates the Twig file, SCSS file, and PHP file for a new page. It also inserts the new AYTemplate (PHP file) into the database and creates a new menu entry for this new page. If it's a multi-language (ML) project, it also translates the menu title.

# update

Updates the MAYS backend and frontend for a given project. The project path must be passed via arguments.

# meta2json

Converts a meta in BD mode to JSON format.

Converts a menu in BD mode to JSON format.

# generate:thumbs

Re-generates all the thumbnails for a given schema.

# clear:contents

(USE CAREFULLY) Clears all unsigned contents by recursively searching all schemas to see if the item is in the content folder.

Last Updated: 6/13/2025, 3:50:20 PM