Account Customization

Now that we have a page for each author, it’d be nice for authors to be able to personalize it. Let’s add a user bio at the top of the page, along with a display name, birth date, display picture, and a banner picture.

Let’s start by adding a profile column to the users table.

Create a new migration file from the REPL, like so:

 user=>​ (​create-migration​ ​"alter-users-add-profile"​)
 nil

Then we write the database migration to add our profile column.

 ALTER​ ​TABLE​ users
 ADD​ ​COLUMN​ ​profile​ JSONB ​DEFAULT​ ​'{}'​::JSONB;

And we add the rollback migration.

Get Web Development with Clojure, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.