-
My project structure is roughly like this:
And I use embedded migrations. I have total of 9 migrations. Migrations that are related to the question are: -- V3__create_posts_table.sql
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
title VARCHAR(128) NOT NULL,
content TEXT NOT NULL,
due_date TIMESTAMPTZ NOT NULL,
hide_post BOOLEAN NOT NULL,
hint_title BOOLEAN NOT NULL,
hint_tags BOOLEAN NOT NULL,
hint_due_date BOOLEAN NOT NULL,
hint_hash HINT_HASH_TYPE NOT NULL, -- custom type, ignore
post_content TEXT NOT NULL,
status STATUS_TYPE NOT NULL -- custom type, ignore
); -- V8__create_users_table.sql
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(64) NOT NULL UNIQUE,
password VARCHAR(64) NOT NULL,
created_at TIMESTAMP NOT NULL
); -- V9__add_user_id_to_posts_table.sql
ALTER TABLE posts
ADD COLUMN user_id INTEGER REFERENCES users(id)
ON DELETE CASCADE; The program runs the first eight migrations but totally ignores the 9th migration. When I create a new fresh database, the logs are:
Why does it not run? Environment
|
Beta Was this translation helpful? Give feedback.
Answered by
erayerdin
Jun 17, 2022
Replies: 1 comment 1 reply
-
Strangely, when I have moved |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
erayerdin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Strangely, when I have moved
embedded
module somewhere else (thus causing Rust to recompile), it applied the migrations. So, it might be an idea to simply removetarget
directory and recompile the project again, I think?