Refine Your App

Okay, enough with the overview. Let’s write some code.

Managing Database Migrations

The first thing we need to do is to initialize the database. The template generates two example migration files in the resources/migrations folder. Note the date on your files will be different since it’s set to the date the application was instantiated. Let’s delete the files generated by the template before proceeding.

 $ ​​rm​​ ​​resources/migrations/*

Next, let’s see how to add migrations that are appropriate for our application. New pairs of migration files can be generated from the REPL by running the create-migration function:

 user=>​ (​create-migration​ ​"guestbook"​)
 nil
 user=>

A common beginner error that you may encounter ...

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.