Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 498
Vasco Ferreira Avatar asked Mar 06 '23 10:03

Vasco Ferreira


1 Answers

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

like image 96
Michiel Borkent Avatar answered May 21 '23 14:05

Michiel Borkent