mahnung/sql/llx_mahnung_mahnung.sql
Eduard Wisch bfc89917b1
All checks were successful
Deploy mahnung / deploy (push) Successful in 14s
fix(mahnung): tms-Spalten auf ON UPDATE CURRENT_TIMESTAMP umstellen [deploy]
tms war als reines TIMESTAMP angelegt -> unter explicit_defaults_for_timestamp
NULL DEFAULT NULL, blieb daher bei jedem UPDATE leer. Jetzt Dolibarr-Standard
DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP fuer mahnung/stufe/
trackingpattern. Neue idempotente Migration migrateTimestampSpalten() im init()
befuellt Alt-NULLs aus datec und stellt die Spalte per ALTER TABLE um.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 18:13:25 +02:00

39 lines
1.7 KiB
SQL

-- Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- Mahnvorgaenge zu Kundenrechnungen
CREATE TABLE llx_mahnung_mahnung (
rowid INTEGER AUTO_INCREMENT PRIMARY KEY,
entity INTEGER DEFAULT 1 NOT NULL,
ref VARCHAR(30) NOT NULL,
fk_facture INTEGER NOT NULL,
fk_soc INTEGER NOT NULL,
stufe TINYINT NOT NULL,
date_mahnung DATE NOT NULL,
date_lim_reglement_alt DATE,
date_lim_reglement_neu DATE,
betrag_offen DOUBLE(24,8) DEFAULT 0,
mahngebuehr DOUBLE(10,2) DEFAULT 0,
pauschale_b2b DOUBLE(10,2) DEFAULT 0,
verzugszinsen DOUBLE(10,2) DEFAULT 0,
summe_mahnung DOUBLE(24,8) DEFAULT 0,
versandart VARCHAR(20) DEFAULT 'pdf',
customertype VARCHAR(3),
basiszins_snapshot DECIMAL(5,4),
pdf_path VARCHAR(255),
note_private TEXT,
status TINYINT DEFAULT 0 NOT NULL,
date_versand DATETIME,
versandweg VARCHAR(30),
tracking_nr VARCHAR(50),
tracking_provider VARCHAR(20),
datec DATETIME,
tms TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat INTEGER,
fk_user_modif INTEGER
) ENGINE=InnoDB;