bikeshedder / tusker

PostgreSQL migration management tool
The Unlicense
208 stars 17 forks source link

problem of migration tables created by marv #6

Closed geohuz closed 3 years ago

geohuz commented 3 years ago

The marv lib will create "migrations" and "migrations_lock" table in the migrate target db, so the second migrate script after initial, when using tusker diff database schema (The database I've setup to target db):

alter table "public"."migrations" drop constraint "migrations_pkey";
drop index if exists "public"."migrations_pkey";
drop table "public"."migrations";
drop table "public"."migrations_lock";

alter table "public"."fruit" add column "color" text default ''::text;

As you can see from above four statements have been generated as there is no migrations in the source schema, but that will crash the marv script. So if there is anyway to specify on the tusker side to ignore the "migrations" tables?

geohuz commented 3 years ago

I found if wrote:

tusker diff migrations schema 

then it is ok! May be it is better to document the steps for the scenario, it may confuse new comer like me :-)

bikeshedder commented 3 years ago

If you are working with a schema file you should be diffing your migrations against the schema and not the database. That's the default btw. If you just run tusker diff it will do exactly the same thing as running tusker diff migrations schema.

Could you provide some insight what feature and/or documentation you were missing?