Goose doesnt run multiple migrations. #650
Replies: 1 comment
-
UPDATE: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello folks, I just started my GoLang journey, and im creating some backend APIs for this project, and using goose to generate code from raw sql.
So I have two schemas, users, and feeds as follow:
`
-- +goose Up
CREATE TABLE users (
id UUID NOT NULL,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
name TEXT NOT NULL,
PRIMARY KEY(id),
api_key VARCHAR(64) NOT NULL UNIQUE
);
-- +goose Down
DROP TABLE users;
`
`
-- +goose up
CREATE TABLE feeds (
id UUID PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
name TEXT NOT NULL,
url TEXT UNIQUE NOT NULL,
user_id UUID REFERENCES users(id) ON DELETE CASCADE
)
-- +goose down
DROP TABLE feeds
`
However, when I run
goose postgres postgres://dbName:Password@host:5432/project-name up
it prinst the following error: ERROR 002_feeds.sql: failed to parse SQL migration file: failed to parse migration: unexpected state 0 on line "CREATE TABLE feeds (.This error doesnt occur when I only have one schema. Can someone help me ?
Regards,
Emad.
Beta Was this translation helpful? Give feedback.
All reactions