Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --ignore-constraint-names option #167

Open
wants to merge 7 commits into
base: next_release
Choose a base branch
from

Conversation

laurentmartelli
Copy link

Add --ignore-constraint-names option to compare constraints using only the definition

@jdufresne
Copy link

Any chance this PR could be looked at? I would find this feature extremely useful. Thanks.

These options allow to generate PRIMARY KEY and FOREIGN KEY
constraints in the CREATE TABLE statement. It currently only works for
single column constraints: multicolumn primary keys and foreign keys
are still generated separately after the CREATE TABLE statement.
Only generate inline FOREIGN KEY constraints when the target table is
in the old schema to avoid referencing non existing tables.
It enables to group multiple "ALTER TABLE" statements for the same
table into a single statement.
@chadfurman
Copy link
Collaborator

@jdufresne could you pull it down and try it out for your use case and let us know how it goes?

@jdufresne
Copy link

I don't see any documentation on building the project. If I missed it, please let me know and I'll try to follow it. I took a guess and ran ant (sorry, am not up to date in the Java world). I get the following build failures. So at the moment I can't test it as I don't know how to build it.

$ ant
Buildfile: /home/jon/devel/apgdiff/build.xml

init:

get-deps:
    [mkdir] Created dir: /home/jon/devel/apgdiff/lib
      [get] Getting: http://mirrors.ibiblio.org/pub/mirrors/maven2/junit/junit/4.8.1/junit-4.8.1.jar
      [get] To: /home/jon/devel/apgdiff/lib/junit.jar
      [get] http://mirrors.ibiblio.org/pub/mirrors/maven2/junit/junit/4.8.1/junit-4.8.1.jar permanently moved to /maven2/junit/junit/4.8.1/junit-4.8.1.jar
      [get] http://mirrors.ibiblio.org/maven2/junit/junit/4.8.1/junit-4.8.1.jar permanently moved to http://maven.ibiblio.org/maven2/
      [get] Getting: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/hamcrest/hamcrest-all/1.1/hamcrest-all-1.1.jar
      [get] To: /home/jon/devel/apgdiff/lib/hamcrest-all.jar
      [get] http://mirrors.ibiblio.org/pub/mirrors/maven2/org/hamcrest/hamcrest-all/1.1/hamcrest-all-1.1.jar permanently moved to /maven2/org/hamcrest/hamcrest-all/1.1/hamcrest-all-1.1.jar
      [get] http://mirrors.ibiblio.org/maven2/org/hamcrest/hamcrest-all/1.1/hamcrest-all-1.1.jar permanently moved to http://maven.ibiblio.org/maven2/

compile:
    [mkdir] Created dir: /home/jon/devel/apgdiff/build/classes
    [javac] /home/jon/devel/apgdiff/build.xml:41: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 47 source files to /home/jon/devel/apgdiff/build/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
    [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    [javac] /home/jon/devel/apgdiff/src/main/java/cz/startnet/utils/pgdiff/schema/PgTable.java:17: error: package org.apache.commons.collections4 does not exist
    [javac] import org.apache.commons.collections4.IterableUtils;
    [javac]                                       ^
    [javac] /home/jon/devel/apgdiff/src/main/java/cz/startnet/utils/pgdiff/schema/PgTable.java:18: error: package org.apache.commons.lang3 does not exist
    [javac] import org.apache.commons.lang3.StringUtils;
    [javac]                                ^
    [javac] /home/jon/devel/apgdiff/src/main/java/cz/startnet/utils/pgdiff/parsers/ParserUtils.java:13: error: package org.apache.commons.collections4 does not exist
    [javac] import org.apache.commons.collections4.CollectionUtils;
    [javac]                                       ^
    [javac] /home/jon/devel/apgdiff/src/main/java/cz/startnet/utils/pgdiff/parsers/ParserUtils.java:14: error: package org.apache.commons.collections4 does not exist
    [javac] import org.apache.commons.collections4.Transformer;
    [javac]                                       ^
    [javac] /home/jon/devel/apgdiff/src/main/java/cz/startnet/utils/pgdiff/schema/PgTable.java:236: error: cannot find symbol
    [javac]                 boolean isPk = pk!=null && pk.getColumns().size()==1 && IterableUtils.get(pk.getColumns(),0).equals(column);
    [javac]                                                                         ^
    [javac]   symbol:   variable IterableUtils
    [javac]   location: class PgTable
    [javac] /home/jon/devel/apgdiff/src/main/java/cz/startnet/utils/pgdiff/schema/PgTable.java:245: error: cannot find symbol
    [javac]                     	sbSQL.append(" REFERENCES "+fk.getTargetTableName()+"("+StringUtils.join(fk.getTargetColumnNames(),",")+")");
    [javac]                     	                                                        ^
    [javac]   symbol:   variable StringUtils
    [javac]   location: class PgTable
    [javac] /home/jon/devel/apgdiff/src/main/java/cz/startnet/utils/pgdiff/parsers/ParserUtils.java:175: error: cannot find symbol
    [javac]     			new Transformer<String,String>() {
    [javac]     			    ^
    [javac]   symbol:   class Transformer
    [javac]   location: class ParserUtils
    [javac] /home/jon/devel/apgdiff/src/main/java/cz/startnet/utils/pgdiff/parsers/ParserUtils.java:173: error: cannot find symbol
    [javac]     	CollectionUtils.transform(
    [javac]     	^
    [javac]   symbol:   variable CollectionUtils
    [javac]   location: class ParserUtils
    [javac] 8 errors
    [javac] 4 warnings

BUILD FAILED
/home/jon/devel/apgdiff/build.xml:41: Compile failed; see the compiler error output for details.

Total time: 2 seconds

@chadfurman
Copy link
Collaborator

Ant is correct -- are you on the develop branch?

@jdufresne
Copy link

are you on the develop branch?

No. I'm on @laurentmartelli's next_release branch so as to test this change. Does this need to be rebased?

@chadfurman
Copy link
Collaborator

chadfurman commented Jul 11, 2017

@jdufresne this branch might need to be rebased, or atleast have the latest version of develop merged into it. Develop builds fine locally for me -- I haven't tried this branch.

Sorry about my other question -- obviously you were on the branch associated with the PR. It's been a long couple of weeks :)

@jdufresne
Copy link

Just tested, the develop branch builds fine for me, just not this one.

@chadfurman
Copy link
Collaborator

@jdufresne can you merge develop into this branch locally and re-test?

@jdufresne
Copy link

can you merge develop into this branch locally and re-test?

Auto merge failed so I can't test further. I don't really want to handle the merge by hand as I have no experience with the code base and haven't touched Java in years. If someone else were to rebase or merge the branch I'd happily test the this feature as a user though.

@chadfurman
Copy link
Collaborator

chadfurman commented Jul 13, 2017 via email

@chadfurman
Copy link
Collaborator

We'll need to rebase this branch to solve this feature -- anyone interested in taking this on?

@laurentmartelli
Copy link
Author

laurentmartelli commented Sep 6, 2017 via email

@chadfurman
Copy link
Collaborator

@laurentmartelli No worries. We'll get this cleaned up at some point :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants