Original issue description @lduf (transferred to discussion #514)
Description:
This feature introduces the ability to dynamically create specific database schemas for individual teams. Each team will have its own schema, including custom tables such as fields, items, and links. The process will rely on Artisan commands to manage schema creation and migration execution, ensuring flexibility and modularity in the system. Tests will validate all functionalities to ensure a seamless experience.
Tasks to Perform:
-
Artisan Command to Generate Specific Schemas:
- Implement an Artisan command:
php artisan make:schema TEAM_ID
- This command must:
- Verify if a schema for
TEAM_ID already exists.
- Create a new schema in the database if it does not exist.
-
Organize Schema-Specific Migrations:
- Establish a directory structure for migrations:
/database/migrations/global: Contains global migrations.
/database/migrations/teams/TEAM_ID: Contains migrations specific to a team.
-
Artisan Command to Copy and Execute Base Table Migrations:
- Implement an Artisan command:
php artisan migration:copy TABLE_NAME SCHEMA
- This command must:
- Copy all required global migration files into the directory
teams/TEAM_ID.
- Execute the copied migrations in the specified schema.
-
Handle Global Migration Files:
- Approach: Direct Copy of Global Files
- Identify all global migrations associated with a table and copy them into the team-specific schema directory.
- Retain the complete history of table changes.
-
Schema Migration Execution:
- Execute all migrations in a specified schema using an Artisan command.
-
Unit and Functional Testing:
- Develop tests to validate the following functionalities:
- Creating a specific schema.
- Executing migrations within a specific schema.
- Verifying the creation of the necessary tables.
- Test cases:
- A team with an existing schema.
- A team requiring multiple global migration files for a single table.
Original issue description @lduf (transferred to discussion #514)
Description:
This feature introduces the ability to dynamically create specific database schemas for individual teams. Each team will have its own schema, including custom tables such as
fields,items, andlinks. The process will rely on Artisan commands to manage schema creation and migration execution, ensuring flexibility and modularity in the system. Tests will validate all functionalities to ensure a seamless experience.Tasks to Perform:
Artisan Command to Generate Specific Schemas:
TEAM_IDalready exists.Organize Schema-Specific Migrations:
/database/migrations/global: Contains global migrations./database/migrations/teams/TEAM_ID: Contains migrations specific to a team.Artisan Command to Copy and Execute Base Table Migrations:
teams/TEAM_ID.Handle Global Migration Files:
Schema Migration Execution:
Unit and Functional Testing: