-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Description: Added SQL schemas to support the volunteer management system, including tables for: Event Log: Tracks changes to profiles, teams, and roles. Profile: Stores volunteer details like name, email, and description. Team: Stores team information, including name and description. Role: Defines roles for profiles within teams, with foreign key relationships to profile and team tables. This setup ensures data integrity and supports tracking of volunteer-related events. ## Tests ## Additional information #48 Previous work: #21 Closes: #43
- Loading branch information
Showing
5 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Drop existing tables if they exist | ||
DROP TABLE IF EXISTS event_log; | ||
DROP TABLE IF EXISTS profile; | ||
DROP TABLE IF EXISTS role; | ||
DROP TABLE IF EXISTS team; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Event Log Schema | ||
CREATE TABLE IF NOT EXISTS event_log ( | ||
id TEXT PRIMARY KEY NOT NULL UNIQUE COLLATE BINARY, -- UUID stored as TEXT | ||
schemaVersion INTEGER NOT NULL, | ||
subject TEXT NOT NULL UNIQUE COLLATE BINARY, -- UUID stored as TEXT (could be user or entity performing the action) | ||
subjectSource TEXT NOT NULL DEFAULT 'profile' CHECK("subjectSource" IN ('profile', 'team', 'role', 'special')) | ||
verb TEXT NOT NULL, -- Action (e.g., 'join', 'leave', 'assigned to') | ||
object TEXT NOT NULL UNIQUE COLLATE BINARY, -- UUID stored as TEXT (the affected entity, e.g., profile, team) | ||
objectSource TEXT NOT NULL DEFAULT 'special' CHECK("objectSource" IN ('profile', 'team', 'role', 'special')) | ||
happenedAt TEXT NOT NULL, -- The time the event occurred | ||
insertedAt TEXT NOT NULL, -- When the event log was inserted | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Volunteer Profile Schema | ||
CREATE TABLE IF NOT EXISTS profile ( | ||
id TEXT PRIMARY KEY NOT NULL UNIQUE COLLATE BINARY, -- UUID stored as TEXT | ||
email TEXT NOT NULL UNIQUE, | ||
schemaVersion INTEGER NOT NULL, | ||
name TEXT NOT NULL, | ||
description TEXT, | ||
happenedAt TEXT NOT NULL, | ||
insertedAt TEXT NOT NULL, | ||
links TEXT -- Store markup for social links | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Role Schema | ||
CREATE TABLE IF NOT EXISTS role ( | ||
id TEXT PRIMARY KEY NOT NULL UNIQUE COLLATE BINARY, -- UUID stored as TEXT | ||
schemaVersion INTEGER NOT NULL, | ||
role TEXT NOT NULL, | ||
description TEXT, | ||
teamId TEXT NOT NULL UNIQUE COLLATE BINARY, -- UUID stored as TEXT | ||
profileId TEXT NOT NULL UNIQUE COLLATE BINARY, -- UUID stored as TEXT | ||
happenedAt TEXT NOT NULL, | ||
insertedAt TEXT NOT NULL, | ||
FOREIGN KEY (teamId) REFERENCES team(id), | ||
FOREIGN KEY (profileId) REFERENCES profile(id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Team Schema | ||
CREATE TABLE IF NOT EXISTS team ( | ||
id TEXT PRIMARY KEY NOT NULL UNIQUE COLLATE BINARY, -- UUID stored as TEXT | ||
schemaVersion INTEGER NOT NULL, | ||
name TEXT NOT NULL, | ||
description TEXT, | ||
happenedAt TEXT NOT NULL, | ||
insertedAt TEXT NOT NULL | ||
); |