nidus-sync/migrations/00001_initial.sql
Eli Ribble 4d55a391c9
Retroactively fix some SQL schema problems
I originally wasn't going to do passwords, but after struggling with
webauthn I decided I'd just go for it. It simplifies the code a lot if I
assert that I always have a password, displayname, etc.
2025-11-05 17:36:32 +00:00

39 lines
799 B
SQL

-- +goose Up
CREATE TYPE ArcgisLicenseType AS ENUM (
'advancedUT',
'basicUT',
'creatorUT',
'editorUT',
'fieldWorkerUT',
'GISProfessionalAdvUT',
'GISProfessionalBasicUT',
'GISProfessionalStdUT',
'IndoorsUserUT',
'insightsAnalystUT',
'liteUT',
'standardUT',
'storytellerUT',
'viewerUT');
CREATE TABLE organization (
id SERIAL PRIMARY KEY,
name TEXT
);
CREATE TABLE user_ (
id SERIAL PRIMARY KEY,
arcgis_access_token TEXT,
arcgis_license ArcgisLicenseType,
arcgis_refresh_token TEXT,
arcgis_refresh_token_expires TIMESTAMP,
arcgis_role TEXT,
display_name VARCHAR(200) NOT NULL,
email TEXT,
organization_id INTEGER REFERENCES organization (id),
username TEXT NOT NULL
);
-- +goose Down
DROP TABLE user_;
DROP TABLE organization;
DROP TYPE arcgis_license_type;