Skip to content

[NEW FEATURE] Creation of specific schemas for each team #517

@vqlion

Description

@vqlion

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Schema Migration Execution:

    • Execute all migrations in a specified schema using an Artisan command.
  6. 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.

Metadata

Metadata

Assignees

Labels

New featureNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions