Compare schema

The help for Compare (ctrl-D) says I can select two schemas to compare. When I do this for two MySQL schemas differences viewer shows all the columns from the tables in the source and none of the columns from the tables in the right. It looks like it thinks the target schema is empty.

If I compare individual tables from the two schemas I get the expected results.

Is this a bug or am I doing something wrong? I want to see all tables that have changed structure.

Thank you!

- Alan

10 comments
Comment actions Permalink

In difference viewer on each side you should see new or changed (comparing to the apposite schema) database table objects.

Do you see the objects, which you are comparing for the schemas in the Database tool window? Can you please attach screenshot of the view, describing the problem? What is the Database you are working with?

0
Comment actions Permalink

Here's what I see when I compare the two schemas. Note that the left side is empty.

And here's what I see when I compare a single table. Note that both sides have entries and there is a new column in the right (as expected).

Both databases are MySQL. One is local, the other is on a server.

- Alan

1
Comment actions Permalink

It is not seen the full compare result from the 1st screenshot and I do not know the exact difference between local-main and production-demo schemas, but the compare is working like the following:
on the left you see table name which is being compared, lower you see the differences between the schemas for this table. For example from the screenshots it is seen that local-main does not have companyassessments table, so all it's attributes are shown only on the right, for the production-demo schema.

If local-main schema contains any tables which are different(or are not present in production-demo) schema thyes should be listed on the left on that diff viewer, please try scrolling up/down to check it.

Also I see that compare options which are selected are different on each screenshot: you have "Show equal files" only enabled and "Show differences" option disabled on the 2nd screenshot. To see equal objects in the schema compare, please enable "Show equal files" option.

p.s. also please make sure that both schemas were introspected successfully before comparison (that you see those tables in Database tool window).

0
Comment actions Permalink

So scrolling down is important. If I scroll down I see the tables from the other database. However, the display treats both sets of tables as being missing in the other database. That is, if I have /database1/table1 and /database2/table1 (same table in both databases) the compare tool makes it appear that table1 does not appear in database2 (and must be migrated) AND that table1 does not appear in database1. This screenshot shows the spot in the report where the tables change. Even though it isn't apparent in this report all of the tables exist in both databases.

1
Comment actions Permalink

>the compare tool makes it appear that table1 does not appear in database2 (and must be migrated) AND that table1 does not appear in database1.

Are you comparing distinct schemas or complete datasources? Do you see these tables in Database Tool Window for the databases? Please make sure that the schemas you are comparing were introspected (were selected in Schemas tab for the Data Source and you invoked Synnchronize action for the Data Source). Because Schema compare tool compares objects, which were introspected by DataGrip and which you then see in Database Tool Window.

0
Comment actions Permalink

OK, I figured out the problem/bug. The names of the databases are different. mts_ondemand vs demo. If I compare two databases with the same name then the compare works much better.

This is confusing because comparing two tables in databases with different names works as expected.

I'll open a bug report.

Thanks for hanging in there.

0
Comment actions Permalink

Thanks! We will look into this.

0
Comment actions Permalink

Hi, Andrey

Is there any update with this issue. I would love to see some solution.
I tried in
WebStorm 2016.2
Build #WS-162.1121.31, built on July 9, 2016

and

IntelliJ IDEA 2016.2
Build #IU-162.1121.32, built on July 9, 2016

I am able to compared table per table but not whole schema as described above.

 

0
Comment actions Permalink

hi, when I click "migrate left" or "migrate right", I get sql senteces for migration, like:

ALTER TABLE brigadier_production.clients ADD client_allow_login VARCHAR(100) NOT NULL;

It works fine, because it create a new field, but it allways create it at the end of table, I do need new field to be created on the correct place, in other words, sql should be something like this:

ALTER TABLE brigadier_production.`clients` ADD `client_allow_login` VARCHAR(100NOT NULL AFTER `client_zone`;

in other workds, why I do not get "after client_zone" text on that sentece?

would be possible to get it working on that way?

 

thanks!

Marcos

 

 

 

 

 

0
Comment actions Permalink

@Marcos Botta 
> would be possible to get it working on that way?
In current moment DataGrip could not migrate in such a way.

1

Please sign in to leave a comment.