Carecentive uses a "migration"-based system to create database tables. This allows you to define the database schema once. The system will take care of creating the respective database tables afterwards and in the correct order.
For this purpose, carecentive uses a third-party library: Knex.js. This library is very well documented. You can find the documentation here.
In order to create new database tables, you first have to create a new migration file. This can be done via the command line interface (CLI). Run the following command:
knex migrate:make migration_name
If this does not work, use the following command:
npx knex migrate:make migration_name
You will now have a new Javascript file in your /database/migrations folder. You can fill this file with the respective database definitions. There will be two sections: One section to "migrate upwards", and one section to revert the database changes again.
We now have to perform the actual database migration. After you wrote the migration, run
knex migrate:latest
Knex will now run your migration. If everything worked well, your new database table (or whichever changes you want to perform) should now be applied to the actual database table.
Have more questions? Knex.js also offers an extended documentation on the migration CLI.