update component

This commit is contained in:
2025-09-23 11:54:33 +02:00
parent a05b127a0e
commit 1960c1b68c
16 changed files with 1197 additions and 535 deletions

View File

@ -0,0 +1,29 @@
-- CREA la nuova tabella (se non esiste)
CREATE TABLE IF NOT EXISTS `#__circolari_attachments` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`circolare_id` INT(11) UNSIGNED NOT NULL,
`path` VARCHAR(255) NOT NULL,
`title` VARCHAR(190) DEFAULT NULL,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_circolare_id` (`circolare_id`)
) ENGINE=InnoDB DEFAULT COLLATE=utf8mb4_unicode_ci;
-- AGGIUNGI il nuovo campo alla tabella principale (se non esiste)
ALTER TABLE `#__circolari`
ADD COLUMN `attachment_id` INT(11) UNSIGNED DEFAULT NULL
AFTER `scadenza`;
-- MIGRAZIONE DATI (opzionale): porta il vecchio allegato singolo nella nuova tabella
INSERT INTO `#__circolari_attachments` (`circolare_id`, `path`, `title`, `ordering`)
SELECT `id`, `attachment`, COALESCE(`allegato_titolo`, ''), 0
FROM `#__circolari`
WHERE `attachment` IS NOT NULL AND `attachment` <> '';
-- RIMUOVI i vecchi campi
ALTER TABLE `#__circolari`
DROP COLUMN `allegato_titolo`,
DROP COLUMN `attachment`;
-- INDICE (opzionale, per il nuovo campo)
ALTER TABLE `#__circolari` ADD KEY `idx_attachment_id` (`attachment_id`);