Project

General

Profile

dev #1998

Updated by Ayat Rahman about 1 year ago

### **Description:**   

 Set Create and define the database schema and migrations for the Aiaxio platform using Drizzle ORM. This includes setting up the backend project structure `ai_tools` table and its dependent tables, such as `tags`, `categories`, `pricing_plans`, and related linking tables. 

 --- 

 ### **Tasks:**   

 1. **Define `ai_tools` Table:**   
    - Create the `ai_tools` table with Express.js, including routing, middleware (e.g., authentication, error handling), nullable fields, as no field is mandatory at this stage.   
    - Ensure proper field types, constraints, and dependencies (e.g., Zod). default values are applied.   

 2. **Create Dependent Tables:**   
    - `Tags`, `Categories`, `Pricing Plans`, `Tool Social Links`, `Tool Verifications`, `AI Tool Tags`.   
    - Establish a modular folder relationships and cascading actions (`delete: cascade` where applicable).   

 3. **Implement Indexes and Foreign Keys:**   
    - Add necessary indexes to optimize queries.   
    - Define foreign key constraints to maintain data integrity.   

 4. **Create Migrations:**   
    - Generate migration files using Drizzle ORM.   
    - Ensure all tables and relationships are included.   
    - Test migration up/down operations to ensure reliability.   

 5. **Documentation:**   
    - Document the schema and relationships in the project wiki or README.   
    - Provide examples of how to query the schema using Drizzle ORM.   

 --- 

 ### **Acceptance Criteria:**   

 - [ ] The `ai_tools` and related tables are created successfully.   
 - [ ] All fields are set as nullable where applicable.   
 - [ ] Migrations run without errors (up/down).   
 - [ ] Relationships and foreign keys are correctly defined.   
 - [ ] Documentation is complete and accessible to the team.   

 --- 

 ### **Notes:**   

 Refer to the existing schema and PRD documents for field details and relationships. Use UUIDs for primary keys and set up default values where applicable. Ensure compliance with the platform's data structure and business logic requirements. 

 --- 

 If you need any additional details or if there are specific guidelines for controllers, services, the naming conventions and routes to support future scalability. coding standards, please let me know!

Back