[mig/maintainability] add some detail comments to migration files

This commit is contained in:
c0repwn3r 2023-03-01 10:09:59 -05:00
parent 58be3b0c4a
commit 830301f491
Signed by: core
GPG Key ID: FDBF740DADDCEECF
5 changed files with 9 additions and 9 deletions

View File

@ -17,10 +17,10 @@
CREATE TABLE users ( CREATE TABLE users (
id SERIAL NOT NULL PRIMARY KEY, id SERIAL NOT NULL PRIMARY KEY,
email VARCHAR(320) NOT NULL UNIQUE, email VARCHAR(320) NOT NULL UNIQUE,
created_on INTEGER NOT NULL, created_on INTEGER NOT NULL, -- Unix (seconds) timestamp of user creation
banned INTEGER NOT NULL, banned INTEGER NOT NULL, -- Is the user banned? 1=Yes 0=No
ban_reason VARCHAR(1024) NOT NULL, ban_reason VARCHAR(1024) NOT NULL, -- What is the reason for this user's ban?
totp_secret VARCHAR(128) NOT NULL, totp_secret VARCHAR(128) NOT NULL,
totp_verified INTEGER NOT NULL, totp_verified INTEGER NOT NULL,

View File

@ -17,5 +17,5 @@
CREATE TABLE magic_links ( CREATE TABLE magic_links (
id VARCHAR(39) NOT NULL PRIMARY KEY UNIQUE, id VARCHAR(39) NOT NULL PRIMARY KEY UNIQUE,
user_id SERIAL NOT NULL REFERENCES users(id), user_id SERIAL NOT NULL REFERENCES users(id),
expires_on INTEGER NOT NULL expires_on INTEGER NOT NULL -- Unix (seconds) timestamp of when this link expires
); );

View File

@ -17,5 +17,5 @@
CREATE TABLE session_tokens ( CREATE TABLE session_tokens (
id VARCHAR(39) NOT NULL PRIMARY KEY, id VARCHAR(39) NOT NULL PRIMARY KEY,
user_id SERIAL NOT NULL REFERENCES users(id), user_id SERIAL NOT NULL REFERENCES users(id),
expires_on INTEGER NOT NULL expires_on INTEGER NOT NULL -- Unix (seconds) timestamp of when this session expires
); );

View File

@ -16,7 +16,7 @@
CREATE TABLE totp_create_tokens ( CREATE TABLE totp_create_tokens (
id VARCHAR(41) NOT NULL PRIMARY KEY, id VARCHAR(41) NOT NULL PRIMARY KEY,
expires_on INTEGER NOT NULL, expires_on INTEGER NOT NULL, -- The unix (seconds) timestamp of when this TOTP create token expires
totp_otpurl VARCHAR(3000) NOT NULL, totp_otpurl VARCHAR(3000) NOT NULL,
totp_secret VARCHAR(128) NOT NULL totp_secret VARCHAR(128) NOT NULL
); );

View File

@ -17,8 +17,8 @@
CREATE TABLE organizations ( CREATE TABLE organizations (
id SERIAL NOT NULL PRIMARY KEY, id SERIAL NOT NULL PRIMARY KEY,
owner SERIAL NOT NULL REFERENCES users(id), owner SERIAL NOT NULL REFERENCES users(id),
ca_key VARCHAR(3072) NOT NULL, ca_key VARCHAR(3072) NOT NULL, -- The hex-encoded ENCRYPTED (see below) concatenation of all CA keys on this org
ca_crt VARCHAR(3072) NOT NULL, ca_crt VARCHAR(3072) NOT NULL, -- The concatenation of all CA certificates on this org. This is passed directly to NebulaCAPool
iv VARCHAR(128) NOT NULL iv VARCHAR(128) NOT NULL -- The 12-byte hex-encoded IV, used to encrypt ca_key with the instance AES key
); );
CREATE INDEX idx_organizations_owner ON organizations(owner); CREATE INDEX idx_organizations_owner ON organizations(owner);