fix: insertion freeproVentilationLines par lots de 50 pour eviter limite MySQL
This commit is contained in:
28
.manus/db/db-query-1780662192829.json
Normal file
28
.manus/db/db-query-1780662192829.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"query": "SELECT id, email, name, role, isActive, loginMethod, passwordHash IS NOT NULL as hasPassword FROM users WHERE role = 'admin' OR email LIKE '%pareige%' OR email LIKE '%admin%';",
|
||||
"command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.bd4328423008 --database fo4DRyBgjsuiigFAgNLuWm --execute SELECT id, email, name, role, isActive, loginMethod, passwordHash IS NOT NULL as hasPassword FROM users WHERE role = 'admin' OR email LIKE '%pareige%' OR email LIKE '%admin%';",
|
||||
"rows": [
|
||||
{
|
||||
"id": "1",
|
||||
"email": "o.pareige@itinova.org",
|
||||
"name": "Administrateur",
|
||||
"role": "admin",
|
||||
"isActive": "1",
|
||||
"loginMethod": "local",
|
||||
"hasPassword": "1"
|
||||
},
|
||||
{
|
||||
"id": "30001",
|
||||
"email": "adminItinova",
|
||||
"name": "Administrateur Itinova",
|
||||
"role": "admin",
|
||||
"isActive": "1",
|
||||
"loginMethod": "local",
|
||||
"hasPassword": "1"
|
||||
}
|
||||
],
|
||||
"messages": [],
|
||||
"stdout": "id\temail\tname\trole\tisActive\tloginMethod\thasPassword\n1\to.pareige@itinova.org\tAdministrateur\tadmin\t1\tlocal\t1\n30001\tadminItinova\tAdministrateur Itinova\tadmin\t1\tlocal\t1\n",
|
||||
"stderr": "",
|
||||
"execution_time_ms": 428
|
||||
}
|
||||
9
.manus/db/db-query-1780662202220.json
Normal file
9
.manus/db/db-query-1780662202220.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"query": "UPDATE users SET passwordHash = '$2b$10$9W4GwfiBPW4HOKupaNKFPOrLU76AbgcVk3wV2Rcb4Z9Xw9ORZOdNW', loginMethod = 'local' WHERE email = 'o.pareige@itinova.org';",
|
||||
"command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.bd4328423008 --database fo4DRyBgjsuiigFAgNLuWm --execute UPDATE users SET passwordHash = '$2b$10$9W4GwfiBPW4HOKupaNKFPOrLU76AbgcVk3wV2Rcb4Z9Xw9ORZOdNW', loginMethod = 'local' WHERE email = 'o.pareige@itinova.org';",
|
||||
"rows": [],
|
||||
"messages": [],
|
||||
"stdout": "",
|
||||
"stderr": "",
|
||||
"execution_time_ms": 269
|
||||
}
|
||||
10
server/db.ts
10
server/db.ts
@@ -966,9 +966,13 @@ export async function createFreeproImport(
|
||||
const result = await db.insert(freeproImports).values(data);
|
||||
const importId = (result as unknown as { insertId: number }).insertId;
|
||||
if (lines.length > 0) {
|
||||
await db.insert(freeproVentilationLines).values(
|
||||
lines.map((l) => ({ ...l, importId }))
|
||||
);
|
||||
const mappedLines = lines.map((l) => ({ ...l, importId }));
|
||||
// Insérer par lots de 50 pour éviter les limites de paramètres MySQL
|
||||
const BATCH_SIZE = 50;
|
||||
for (let i = 0; i < mappedLines.length; i += BATCH_SIZE) {
|
||||
const batch = mappedLines.slice(i, i + BATCH_SIZE);
|
||||
await db.insert(freeproVentilationLines).values(batch);
|
||||
}
|
||||
}
|
||||
return importId;
|
||||
}
|
||||
|
||||
2
todo.md
2
todo.md
@@ -656,4 +656,4 @@
|
||||
- [x] Page VentilationFreePro.tsx : import drag&drop, tableau de ventilation, historique, export PDF
|
||||
- [x] Menu "Ventilations > FreePro" ajouté dans DashboardLayout
|
||||
- [x] Route /ventilation-freepro ajoutée dans App.tsx
|
||||
- [ ] Déploiement sur recette
|
||||
- [x] Déploiement sur recette (git pull + migrations DB + docker compose up --build)
|
||||
|
||||
Reference in New Issue
Block a user