Initial commit
This commit is contained in:
commit
97fcc33283
50 files changed
+3211
No files matched your search
@@ -0,0 +1,17 @@
|
||||
---
|
||||
description: SQL and database safety — queries, migrations, and indexes
|
||||
globs: **/*.{sql,prisma},**/migrations/**/*
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# SQL & Database
|
||||
|
||||
- Always use parameterized queries or an ORM. Never interpolate user input into SQL strings.
|
||||
- Migrations must be reversible or include a documented rollback path.
|
||||
- Add indexes for columns used in `WHERE`, `JOIN`, and `ORDER BY` on large tables.
|
||||
- Avoid `SELECT *` in application code — select only needed columns.
|
||||
- Use transactions for multi-step writes that must succeed or fail together.
|
||||
- Set `statement_timeout` on long-running queries in production.
|
||||
- Never store plaintext passwords. Use bcrypt, Argon2id, or scrypt.
|
||||
- Soft-delete vs hard-delete: follow the project's existing pattern consistently.
|
||||
- Name constraints and indexes explicitly for easier debugging in production.
|
||||
Reference in new issue
Block a user