tenseleyflow/shithub / d73e472

Browse files

Add migration 0014: profile columns (bio, location, website, company, pronouns, avatar_object_key)

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
d73e472baa87a23078851da5457b00bb22b58c50
Parents
b544c8e
Tree
63b8402

1 changed file

StatusFile+-
A internal/migrationsfs/migrations/0014_users_profile_columns.sql 30 0
internal/migrationsfs/migrations/0014_users_profile_columns.sqladded
@@ -0,0 +1,30 @@
1
+-- SPDX-License-Identifier: AGPL-3.0-or-later
2
+--
3
+-- Public profile fields. All optional. avatar_object_key references the
4
+-- avatars/<owner>/<size>.<ext> prefix on object storage; NULL means
5
+-- "render the deterministic identicon."
6
+
7
+-- +goose Up
8
+ALTER TABLE users
9
+    ADD COLUMN bio               text NOT NULL DEFAULT '',
10
+    ADD COLUMN location          text NOT NULL DEFAULT '',
11
+    ADD COLUMN website           text NOT NULL DEFAULT '',
12
+    ADD COLUMN company           text NOT NULL DEFAULT '',
13
+    ADD COLUMN pronouns          text NOT NULL DEFAULT '',
14
+    ADD COLUMN avatar_object_key text;
15
+
16
+ALTER TABLE users
17
+    ADD CONSTRAINT users_bio_length      CHECK (char_length(bio)      <= 500),
18
+    ADD CONSTRAINT users_location_length CHECK (char_length(location) <= 80),
19
+    ADD CONSTRAINT users_website_length  CHECK (char_length(website)  <= 200),
20
+    ADD CONSTRAINT users_company_length  CHECK (char_length(company)  <= 80),
21
+    ADD CONSTRAINT users_pronouns_length CHECK (char_length(pronouns) <= 40);
22
+
23
+-- +goose Down
24
+ALTER TABLE users
25
+    DROP COLUMN IF EXISTS bio,
26
+    DROP COLUMN IF EXISTS location,
27
+    DROP COLUMN IF EXISTS website,
28
+    DROP COLUMN IF EXISTS company,
29
+    DROP COLUMN IF EXISTS pronouns,
30
+    DROP COLUMN IF EXISTS avatar_object_key;