Skip to content

Commit

Permalink
Bump
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj committed Jan 9, 2025
1 parent 4bcbf7b commit 6eb0d8d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source-repository-package
type: git
location: https://github.com/jaspervdj/urlencoded.git

packages: ./zureg.cabal
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
haskell = pkgs.haskell.packages.ghc94;
haskell = pkgs.haskell.packages.ghc96;
in {
packages = { default = haskell.callCabal2nix "zureg" ./. { }; };
devShells = {
Expand Down
58 changes: 57 additions & 1 deletion lib/Zureg/Database/Migrations/01-init.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,66 @@
CREATE TABLE tshirt_sizes (
tshirt_size TEXT NOT NULL PRIMARY KEY
);

INSERT INTO tshirt_sizes (tshirt_size) VALUES ('XS');
INSERT INTO tshirt_sizes (tshirt_size) VALUES ('S');
INSERT INTO tshirt_sizes (tshirt_size) VALUES ('M');
INSERT INTO tshirt_sizes (tshirt_size) VALUES ('L');
INSERT INTO tshirt_sizes (tshirt_size) VALUES ('XL');
INSERT INTO tshirt_sizes (tshirt_size) VALUES ('XXL');

CREATE TABLE regions (
region TEXT NOT NULL PRIMARY KEY
);

INSERT INTO regions (region) VALUES ('Switzerland');
INSERT INTO regions (region) VALUES ('Europe');
INSERT INTO regions (region) VALUES ('Africa');
INSERT INTO regions (region) VALUES ('AmericaCentral');
INSERT INTO regions (region) VALUES ('AmericaNorth');
INSERT INTO regions (region) VALUES ('AmericaSouth');
INSERT INTO regions (region) VALUES ('Asia');
INSERT INTO regions (region) VALUES ('MiddleEast');
INSERT INTO regions (region) VALUES ('Oceania');

CREATE TABLE occupations (
occupation TEXT NOT NULL PRIMARY KEY
);

INSERT INTO occupations (occupation) VALUES ('Student');
INSERT INTO occupations (occupation) VALUES ('Tech');
INSERT INTO occupations (occupation) VALUES ('Academia');
INSERT INTO occupations (occupation) VALUES ('Other');

CREATE TABLE registrants (
id UUID NOT NULL PRIMARY KEY DEFAULT GEN_RANDOM_UUID(),
email TEXT NOT NULL,
name TEXT NOT NULL,
badge_name TEXT,
affiliation TEXT,
registered_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
registered_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
tshirt_size TEXT,
CONSTRAINT tshirt_size_fk FOREIGN KEY (tshirt_size)
REFERENCES tshirt_sizes (tshirt_size),
region TEXT,
CONSTRAINT region_fk FOREIGN KEY (region) REFERENCES regions (region),
occupation TEXT,
CONSTRAINT registrants_occupation_fk FOREIGN KEY (occupation)
REFERENCES occupations (occupation),
beginner_track_interest BOOLEAN NOT NULL
);

CREATE UNIQUE INDEX registrants_email_idx ON registrants (email);

CREATE TABLE projects (
id UUID NOT NULL PRIMARY KEY DEFAULT GEN_RANDOM_UUID(),
name TEXT NOT NULL,
link TEXT,
short_description TEXT,
contributor_level_beginner BOOLEAN NOT NULL,
contributor_level_intermediate BOOLEAN NOT NULL,
contributor_level_advanced BOOLEAN NOT NULL,
registrant_id UUID NOT NULL,
CONSTRAINT registrant_id_fk FOREIGN KEY (registrant_id)
REFERENCES registrants (id)
);

0 comments on commit 6eb0d8d

Please sign in to comment.