event_sourcing_user_management_poc

PoC for user management in Event Sourcing using SQLite3

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
-- Copyright 2025 Shota FUJI
--
-- This source code is licensed under Zero-Clause BSD License.
-- You can find a copy of the Zero-Clause BSD License at LICENSES/0BSD.txt
-- You may also obtain a copy of the Zero-Clause BSD License at
-- <https://opensource.org/license/0bsd>
--
-- SPDX-License-Identifier: 0BSD

CREATE TABLE user_events (
	seq INTEGER PRIMARY KEY ON CONFLICT ROLLBACK AUTOINCREMENT,
	event_name TEXT NOT NULL ON CONFLICT ROLLBACK,
	payload BLOB
);

CREATE TABLE users_snapshots (
	-- Which event is this snapshot taken at?
	event_seq INTEGER PRIMARY KEY ON CONFLICT ROLLBACK,
	-- Protobuf wire format
	payload BLOB
);

CREATE TABLE initial_admin_creation_password_snapshots (
	-- Which event is this snapshot taken at?
	event_seq INTEGER PRIMARY KEY ON CONFLICT ROLLBACK,
	-- Protobuf wire format
	payload BLOB
);