migrate icon indicating copy to clipboard operation
migrate copied to clipboard

First migration issue cockroachdb

Open incognick opened this issue 7 years ago • 2 comments

I'm having trouble running my first migration against a local cockroachdb instance. I created the initial migration. I ran it and I get the following error:

migrate -database postgresql://[email protected]:26257/main?sslmode=disable -path migrations up error: pq: relation "schema_migrations" does not exist in line 0: INSERT INTO "schema_migrations" (version, dirty) VALUES ($1, $2)

The table exists in the main database:

root@:26257/main> show columns from schema_migrations;
+---------+------+-------+---------+-------------+
|  Field  | Type | Null  | Default |   Indices   |
+---------+------+-------+---------+-------------+
| version | INT  | false | NULL    | {"primary"} |
| dirty   | BOOL | false | NULL    | {}          |
+---------+------+-------+---------+-------------+
(2 rows)
root@:26257/main> SELECT * FROM schema_migrations;
+---------+-------+
| version | dirty |
+---------+-------+
+---------+-------+
(0 rows)

Not sure why this isn't working. I installed using go get.

Thanks for this tool and any help you can provide!

incognick avatar Dec 13 '17 15:12 incognick

I ran into the same issue as well. On ubuntu 18.01, go 1.10.1. Installed the cli using the go get command

kevinmartinjos avatar May 19 '18 18:05 kevinmartinjos

I can repro this inside the cockroach sql shell with:

BEGIN TRANSACTION;
TRUNCATE schema_migrations;
INSERT INTO schema_migrations (version, dirty) VALUES (1, true);
COMMIT;

elliott-davis avatar May 22 '18 03:05 elliott-davis