0003_same_chamber.sql 1005 B

1234567891011121314151617181920212223242526272829
  1. CREATE TABLE `audit_logs` (
  2. `id` int AUTO_INCREMENT NOT NULL,
  3. `action` varchar(64) NOT NULL,
  4. `actorId` int NOT NULL,
  5. `actorName` varchar(255),
  6. `targetId` int,
  7. `targetName` varchar(255),
  8. `details` json,
  9. `createdAt` timestamp NOT NULL DEFAULT (now()),
  10. CONSTRAINT `audit_logs_id` PRIMARY KEY(`id`)
  11. );
  12. --> statement-breakpoint
  13. CREATE TABLE `invitations` (
  14. `id` int AUTO_INCREMENT NOT NULL,
  15. `email` varchar(320) NOT NULL,
  16. `role` enum('user','agent','admin') NOT NULL DEFAULT 'agent',
  17. `token` varchar(64) NOT NULL,
  18. `inviteStatus` enum('pending','accepted','expired','revoked') NOT NULL DEFAULT 'pending',
  19. `invitedById` int NOT NULL,
  20. `invitedByName` varchar(255),
  21. `acceptedByUserId` int,
  22. `message` text,
  23. `expiresAt` timestamp NOT NULL,
  24. `acceptedAt` timestamp,
  25. `createdAt` timestamp NOT NULL DEFAULT (now()),
  26. `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
  27. CONSTRAINT `invitations_id` PRIMARY KEY(`id`),
  28. CONSTRAINT `invitations_token_unique` UNIQUE(`token`)
  29. );