org-SCAN / website

Site web du projet
6 stars 0 forks source link

[NEW FEATURE]Creation of Specific Schemas for Each Team #512

Open lduf opened 13 hours ago

lduf commented 13 hours ago

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.
github-actions[bot] commented 13 hours ago

AI-Assisted Response:

Summary:

This issue is a feature request for the implementation of a system that allows the dynamic creation of database schemas for different teams. Each team's schema will contain custom tables. The system uses Laravel Artisan commands to create schemas, manage migrations, and maintain modularity. Testing is required to ensure the feature's functionality.

Categorization:

Feature Request

Clarified Description:

The new feature should enable the creation of separate database schemas for each team via Artisan commands. The feature will include:

Tags:

@lduf

Clarified Tasks:

  1. Create an Artisan command php artisan make:schema TEAM_ID to generate and check schemas for teams.
  2. Organize migration files into directories for global use and specific teams.
  3. Provide an Artisan command php artisan migration:copy TABLE_NAME SCHEMA to handle copying and executing base table migrations for each schema.
  4. Ensure global migration files are directly copied and used per team's requirements.
  5. Enable schema-specific migration execution through an Artisan command.
  6. Implement unit and functional tests to confirm the creation of schemas, execution of migrations in those schemas, and the accurate establishment of tables.

Questions for Clarification:

  1. Is there a naming convention for the team-specific schemas that we should follow?
  2. Should the php artisan migration:copy TABLE_NAME SCHEMA command validate dependencies or prerequisites of the migrations before copying and executing them?
  3. How should the feature handle potential naming conflicts in table migrations across team schemas?
  4. Is there a rollback plan to handle failed migrations within a team's schema?
  5. What are the performance implications of copying migration files, and is there a preferred strategy to minimize overhead?
  6. Are there any specific security concerns or permissions required for executing schema-related operations for teams?

Suggestions for Implementation:

(These are preliminary suggestions and may require adaptation as the issue is further clarified.)