mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Fix issues with the credits module by improving client-side debugging and database schema
Add client-side debugging scripts for JavaScript errors and unhandled promise rejections to aid in troubleshooting the credits module. Correct the production database schema for the 'avoirs' table by making 'invoice_reference' and 'amount' columns nullable, and include a test insertion to verify the fix. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/mpVybiP
This commit is contained in:
1 parent
d7d918c643
commit
731eb145dd
4 files changed
+290
No files matched your search
@@ -0,0 +1,44 @@
|
||||
-- 🔧 CORRECTION TABLE PRODUCTION
|
||||
-- Script pour corriger la table avoirs en production
|
||||
|
||||
-- 1. Vérifier la structure actuelle
|
||||
SELECT 'STRUCTURE_ACTUELLE' as check_type,
|
||||
column_name,
|
||||
data_type,
|
||||
is_nullable,
|
||||
column_default
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = 'avoirs'
|
||||
ORDER BY ordinal_position;
|
||||
|
||||
-- 2. Corriger les colonnes pour les rendre optionnelles
|
||||
ALTER TABLE avoirs ALTER COLUMN invoice_reference DROP NOT NULL;
|
||||
ALTER TABLE avoirs ALTER COLUMN amount DROP NOT NULL;
|
||||
|
||||
-- 3. Vérifier après correction
|
||||
SELECT 'STRUCTURE_CORRIGÉE' as check_type,
|
||||
column_name,
|
||||
data_type,
|
||||
is_nullable,
|
||||
column_default
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = 'avoirs'
|
||||
ORDER BY ordinal_position;
|
||||
|
||||
-- 4. Test d'insertion avec champs optionnels
|
||||
INSERT INTO avoirs (
|
||||
supplier_id,
|
||||
group_id,
|
||||
comment,
|
||||
commercial_processed,
|
||||
created_by
|
||||
) VALUES (
|
||||
(SELECT id FROM suppliers LIMIT 1),
|
||||
(SELECT id FROM groups LIMIT 1),
|
||||
'Test champs optionnels',
|
||||
false,
|
||||
(SELECT id FROM users LIMIT 1)::varchar
|
||||
) RETURNING id, invoice_reference, amount;
|
||||
|
||||
-- 5. Nettoyer le test
|
||||
DELETE FROM avoirs WHERE comment = 'Test champs optionnels';
|
||||
Reference in new issue
Block a user