portail-associations/drizzle/0009_association_invitations.sql

19 lines
756 B
SQL

CREATE TABLE `associationInvitations` (
`id` int AUTO_INCREMENT NOT NULL,
`directoryEntryId` int NOT NULL,
`emailOfficiel` varchar(320) NOT NULL,
`emailOfficielNormalise` varchar(320) NOT NULL,
`token` varchar(128) NOT NULL,
`deliveryMode` enum('email','manual_link') NOT NULL,
`emailSent` boolean NOT NULL DEFAULT false,
`sentByUserId` int NOT NULL,
`sentAt` timestamp NOT NULL DEFAULT now(),
`expiresAt` timestamp NOT NULL,
`usedAt` timestamp,
`revokedAt` timestamp,
`acceptedByUserId` int,
`createdAt` timestamp NOT NULL DEFAULT now(),
`updatedAt` timestamp NOT NULL DEFAULT now() ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT `associationInvitations_id` PRIMARY KEY(`id`),
CONSTRAINT `associationInvitations_token_unique` UNIQUE(`token`)
);