diff --git a/Makefile b/Makefile index 44eda9560992f..f1b55cfaba274 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ build: site/out/index.html $(shell find . -not -path './vendor/*' -type f -name .PHONY: build # Runs migrations to output a dump of the database. -coderd/database/dump.sql: $(wildcard coderd/database/migrations/*.sql) +coderd/database/dump.sql: coderd/database/dump/main.go $(wildcard coderd/database/migrations/*.sql) go run coderd/database/dump/main.go # Generates Go code for querying the database. diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index 8c3e08a6b1995..9e28ed5bc4c48 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -138,6 +138,8 @@ CREATE TABLE licenses ( exp timestamp with time zone NOT NULL ); +COMMENT ON COLUMN licenses.exp IS 'exp tracks the claim of the same name in the JWT, and we include it here so that we can easily query for licenses that have not yet expired.'; + CREATE SEQUENCE licenses_id_seq AS integer START WITH 1 diff --git a/coderd/database/dump/main.go b/coderd/database/dump/main.go index 20c4ac0c2e30a..1744fc337a463 100644 --- a/coderd/database/dump/main.go +++ b/coderd/database/dump/main.go @@ -41,7 +41,6 @@ func main() { connection, "--no-privileges", "--no-owner", - "--no-comments", // We never want to manually generate // queries executing against this table. diff --git a/coderd/database/models.go b/coderd/database/models.go index 6614a3d6ddb78..f9f559711ec32 100644 --- a/coderd/database/models.go +++ b/coderd/database/models.go @@ -360,7 +360,8 @@ type License struct { ID int32 `db:"id" json:"id"` UploadedAt time.Time `db:"uploaded_at" json:"uploaded_at"` JWT string `db:"jwt" json:"jwt"` - Exp time.Time `db:"exp" json:"exp"` + // exp tracks the claim of the same name in the JWT, and we include it here so that we can easily query for licenses that have not yet expired. + Exp time.Time `db:"exp" json:"exp"` } type Organization struct {