Search code examples
clojureluminus

Clojure Luminus Migrations - Only one table per migration file


I'm creating a web app with Clojure and Luminus, but when I create a migration file with all the tables I need, it will only create the first. This is my user-table.up.sql file:

CREATE TABLE UserTable (
   id INTEGER PRIMARY KEY AUTOINCREMENT,
   first_name VARCHAR(50),
   last_name VARCHAR(50),
   gender VARCHAR(50),
   email VARCHAR(50) UNIQUE,
   password VARCHAR(400),
   time_stamp TIMESTAMP,
   is_active BOOLEAN
);

CREATE TABLE LoginTable (
   id INTEGER PRIMARY KEY AUTOINCREMENT,
   user_id INTEGER,
   time_stamp TIMESTAMP
);

When I run lein run migrate, only the table UserTable is created. Is this supposed to work like this? Do I need to create a migration file for each table?


Solution

  • As you are using Luminus, you are probably using Migratus. If you want to execute multiple statements in one sql file, read this:

    https://github.com/yogthos/migratus#multiple-statements