migration.sql 428 B

12345678910111213
  1. CREATE TABLE `event_sequence` (
  2. `aggregate_id` text PRIMARY KEY,
  3. `seq` integer NOT NULL
  4. );
  5. --> statement-breakpoint
  6. CREATE TABLE `event` (
  7. `id` text PRIMARY KEY,
  8. `aggregate_id` text NOT NULL,
  9. `seq` integer NOT NULL,
  10. `type` text NOT NULL,
  11. `data` text NOT NULL,
  12. CONSTRAINT `fk_event_aggregate_id_event_sequence_aggregate_id_fk` FOREIGN KEY (`aggregate_id`) REFERENCES `event_sequence`(`aggregate_id`) ON DELETE CASCADE
  13. );