| 1234567891011121314151617181920212223242526272829 |
- CREATE TABLE `audit_logs` (
- `id` int AUTO_INCREMENT NOT NULL,
- `action` varchar(64) NOT NULL,
- `actorId` int NOT NULL,
- `actorName` varchar(255),
- `targetId` int,
- `targetName` varchar(255),
- `details` json,
- `createdAt` timestamp NOT NULL DEFAULT (now()),
- CONSTRAINT `audit_logs_id` PRIMARY KEY(`id`)
- );
- --> statement-breakpoint
- CREATE TABLE `invitations` (
- `id` int AUTO_INCREMENT NOT NULL,
- `email` varchar(320) NOT NULL,
- `role` enum('user','agent','admin') NOT NULL DEFAULT 'agent',
- `token` varchar(64) NOT NULL,
- `inviteStatus` enum('pending','accepted','expired','revoked') NOT NULL DEFAULT 'pending',
- `invitedById` int NOT NULL,
- `invitedByName` varchar(255),
- `acceptedByUserId` int,
- `message` text,
- `expiresAt` timestamp NOT NULL,
- `acceptedAt` timestamp,
- `createdAt` timestamp NOT NULL DEFAULT (now()),
- `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
- CONSTRAINT `invitations_id` PRIMARY KEY(`id`),
- CONSTRAINT `invitations_token_unique` UNIQUE(`token`)
- );
|