This commit is contained in:
2026-02-06 09:17:51 +01:00
parent 3f474c4d39
commit 2e40d48a9a
17 changed files with 1659 additions and 329 deletions

View File

@ -1,51 +1,55 @@
BEGIN TRANSACTION;
CREATE TABLE [MailQueue] (
[Id] uniqueidentifier NOT NULL,
[Subject] nvarchar(max) NOT NULL,
[Body] nvarchar(max) NOT NULL,
[ToList] nvarchar(max) NOT NULL,
[Args] nvarchar(max) NULL,
[From] int NOT NULL,
[Sent] bit NOT NULL,
[Error] nvarchar(max) NULL,
[DataCreazione] datetime2 NOT NULL,
[DataModifica] datetime2 NULL,
[Eliminato] bit NOT NULL,
[IdUtenteCreazione] uniqueidentifier NULL,
[IdUtenteModifica] uniqueidentifier NULL,
CONSTRAINT [PK_MailQueue] PRIMARY KEY ([Id]),
CONSTRAINT [FK_MailQueue_Utente_IdUtenteCreazione] FOREIGN KEY ([IdUtenteCreazione]) REFERENCES [Utente] ([Id]),
CONSTRAINT [FK_MailQueue_Utente_IdUtenteModifica] FOREIGN KEY ([IdUtenteModifica]) REFERENCES [Utente] ([Id])
);
CREATE INDEX [IX_MailQueue_IdUtenteCreazione] ON [MailQueue] ([IdUtenteCreazione]);
CREATE INDEX [IX_MailQueue_IdUtenteModifica] ON [MailQueue] ([IdUtenteModifica]);
DROP TABLE [IscrizioneEventoPerMail];
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
VALUES (N'20260109133732_MailQueue', N'9.0.11');
VALUES (N'20260122105724_Rimozione_IscrizioneEventoPerMail', N'9.0.11');
CREATE TABLE [IscrizioneEventoPerMail] (
[Id] uniqueidentifier NOT NULL,
[Mail] nvarchar(max) NOT NULL,
[Processata] bit NOT NULL,
[Inviata] bit NOT NULL,
[DataCreazione] datetime2 NOT NULL,
[DataModifica] datetime2 NULL,
[Eliminato] bit NOT NULL,
[IdUtenteCreazione] uniqueidentifier NULL,
[IdUtenteModifica] uniqueidentifier NULL,
CONSTRAINT [PK_IscrizioneEventoPerMail] PRIMARY KEY ([Id]),
CONSTRAINT [FK_IscrizioneEventoPerMail_Utente_IdUtenteCreazione] FOREIGN KEY ([IdUtenteCreazione]) REFERENCES [Utente] ([Id]),
CONSTRAINT [FK_IscrizioneEventoPerMail_Utente_IdUtenteModifica] FOREIGN KEY ([IdUtenteModifica]) REFERENCES [Utente] ([Id])
);
ALTER TABLE [Utente] ADD [ProvinciaIstatId] uniqueidentifier NULL;
CREATE INDEX [IX_IscrizioneEventoPerMail_IdUtenteCreazione] ON [IscrizioneEventoPerMail] ([IdUtenteCreazione]);
ALTER TABLE [IscrizioneEvento] ADD [AgenteId] uniqueidentifier NULL;
CREATE INDEX [IX_IscrizioneEventoPerMail_IdUtenteModifica] ON [IscrizioneEventoPerMail] ([IdUtenteModifica]);
ALTER TABLE [IscrizioneEvento] ADD [CapoareaId] uniqueidentifier NULL;
CREATE INDEX [IX_Utente_ProvinciaIstatId] ON [Utente] ([ProvinciaIstatId]);
CREATE INDEX [IX_IscrizioneEvento_AgenteId] ON [IscrizioneEvento] ([AgenteId]);
CREATE INDEX [IX_IscrizioneEvento_CapoareaId] ON [IscrizioneEvento] ([CapoareaId]);
ALTER TABLE [IscrizioneEvento] ADD CONSTRAINT [FK_IscrizioneEvento_Utente_AgenteId] FOREIGN KEY ([AgenteId]) REFERENCES [Utente] ([Id]);
ALTER TABLE [IscrizioneEvento] ADD CONSTRAINT [FK_IscrizioneEvento_Utente_CapoareaId] FOREIGN KEY ([CapoareaId]) REFERENCES [Utente] ([Id]);
ALTER TABLE [Utente] ADD CONSTRAINT [FK_Utente_Province_ProvinciaIstatId] FOREIGN KEY ([ProvinciaIstatId]) REFERENCES [Province] ([Id]);
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
VALUES (N'20260120130758_IscrizioneEventoPerMail', N'9.0.11');
VALUES (N'20260204162205_CapiareaAgentiInIscrizioneEvento', N'9.0.11');
ALTER TABLE [Province] ADD [CapoareaDaVerificare] bit NOT NULL DEFAULT CAST(0 AS bit);
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
VALUES (N'20260205095709_CapoareaDaVerificareInProvincia', N'9.0.11');
ALTER TABLE [Utente] DROP CONSTRAINT [FK_Utente_Province_ProvinciaIstatId];
DROP INDEX [IX_Utente_ProvinciaIstatId] ON [Utente];
DECLARE @var sysname;
SELECT @var = [d].[name]
FROM [sys].[default_constraints] [d]
INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id]
WHERE ([d].[parent_object_id] = OBJECT_ID(N'[Utente]') AND [c].[name] = N'ProvinciaIstatId');
IF @var IS NOT NULL EXEC(N'ALTER TABLE [Utente] DROP CONSTRAINT [' + @var + '];');
ALTER TABLE [Utente] DROP COLUMN [ProvinciaIstatId];
ALTER TABLE [Province] ADD [CapoareaId] uniqueidentifier NULL;
CREATE INDEX [IX_Province_CapoareaId] ON [Province] ([CapoareaId]);
ALTER TABLE [Province] ADD CONSTRAINT [FK_Province_Utente_CapoareaId] FOREIGN KEY ([CapoareaId]) REFERENCES [Utente] ([Id]);
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
VALUES (N'20260206070903_CapoareaSuProvIstat', N'9.0.11');
COMMIT;
GO