mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-21 22:18:17 +02:00
- New contacts table (group_id, name, role, phone, email, notes) per store - Suppliers table: add email field with form and card display - Page /contacts: two-column layout (suppliers read-only / free contacts CRUD) - Permissions: read all roles, create/edit/delete admin + directeur + manager - Admin can filter contacts by store; other roles see their own stores only - Migration SQL: 20260515_add_contacts_and_supplier_email.sql Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
718 B
SQL
22 lines
718 B
SQL
-- Migration: Ajout email fournisseurs + table contacts par magasin
|
|
-- Created: 2026-05-15
|
|
|
|
-- Ajout du champ email sur les fournisseurs
|
|
ALTER TABLE suppliers ADD COLUMN IF NOT EXISTS email VARCHAR(255);
|
|
|
|
-- Table des contacts libres, rattachés à un magasin
|
|
CREATE TABLE IF NOT EXISTS contacts (
|
|
id SERIAL PRIMARY KEY,
|
|
group_id INTEGER NOT NULL REFERENCES groups(id) ON DELETE CASCADE,
|
|
name VARCHAR(255) NOT NULL,
|
|
role VARCHAR(255),
|
|
phone VARCHAR(50),
|
|
email VARCHAR(255),
|
|
notes TEXT,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Index pour recherche rapide par magasin
|
|
CREATE INDEX IF NOT EXISTS idx_contacts_group_id ON contacts(group_id);
|