forked from ivangrynenko/cursorrules
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrupal-database-standards.mdc
More file actions
37 lines (27 loc) · 993 Bytes
/
drupal-database-standards.mdc
File metadata and controls
37 lines (27 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
description: Database schema changes, migrations, and query optimization
globs: *.php, *.install, *.module
---
# Drupal Database Standards
Ensures proper database handling in Drupal applications.
## Rule Details
- **Name:** drupal_database_standards
- **Description:** Enforce Drupal database best practices and standards
## Filters
- file extension pattern: `\\.(php|install|module)$`
## Enforcement Checks
- Conditions:
- pattern `db_query` – Use Database API instead of db_query
- pattern `hook_update_N.*\\{\\s*[^}]*\\}` – Ensure hook_update_N includes proper schema changes
- pattern `\\$query->execute\\(\\)` – Consider using try-catch block for database operations
## Suggestions
- Guidance:
Database Best Practices:
- Use Schema API for table definitions
- Implement proper error handling
- Use update hooks for schema changes
- Follow Drupal's database abstraction layer
- Implement proper indexing strategies
## Metadata
- Priority: critical
- Version: 1.1