Skip to content

Persistence

Lucy Ciara Herud-Thomassen edited this page Apr 23, 2026 · 15 revisions

Persistence in this project is achieved using an H2 database, which stores donation history and user accounts.

Structure

users

CREATE TABLE IF NOT EXISTS
users (
user_id INT PRIMARY KEY,
role VARCHAR(32) NOT NULL,
first_name VARCHAR(32) NOT NULL,
last_name VARCHAR(32) NOT NULL,
email VARCHAR(32) NOT NULL,
password_hash VARCHAR(72) NOT NULL
);

donations

CREATE TABLE IF NOT EXISTS
donations (
donation_id INT PRIMARY KEY,
user_id INT NOT NULL,
organization_id INT NOT NULL,
amount DECIMAL(32, 16) NOT NULL,
dating TIMESTAMP NOT NULL,
payment_method VARCHAR(32) NOT NULL,
CONSTRAINT fk_user
FOREIGN KEY (user_id)
REFERENCES users(user_id)
);