Coder Social home page Coder Social logo

waterkip / pgdiff Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joncrlsn/pgdiff

0.0 2.0 0.0 17.26 MB

Compares the PostgreSQL schema between two databases and generates SQL statements that can be run manually against the second database.

License: MIT License

Shell 3.48% Go 96.52%

pgdiff's Introduction

pgdiff - PostgreSQL schema diff

An important feature of this utility is that it never modifies any database directly. You are solely responsible for verifying the generated SQL before running it against your database. Now that you know about that, it should give you confidence that it is safe to try out and see what SQL gets generated.

Written in GoLang, pgdiff compares the schema between two PostgreSQL databases and generates alter statements to be manually run against the second database. At the moment, not everything in the schema is compared, but the things considered important are: roles, sequences, tables, columns (and their default values), primary keys, unique constraints, foreign keys, roles, ownership information, and grants.

It is written to be easy to add and improve the accuracy of the diff. If you find something that seems wrong and you want me to look at it, please send me two schema-only database dumps that I can test with (Use the --schema-only option with pg_dump)

download

osx64 osx32 linux64 linux32 win64 win32

usage

pgdiff [database flags] <schemaType>
program flags Explanation
-U1 first db postgres user
-pw1 first db password
-h1 first db host -- default is localhost
-p1 first db port number. defaults to 5432
-d1 first db name
-U2 second db postgres user
-pw2 second db password
-h2 second db host -- default is localhost
-p2 second db port number. defaults to 5432
-d2 second db name

<schemaType> the type of objects in the schema to compare: ALL, ROLE, SEQUENCE, TABLE, COLUMN, INDEX, FOREIGN_KEY, OWNER, GRANT_RELATIONSHIP, GRANT_ATTRIBUTE

pgdiff's People

Contributors

joncrlsn avatar

Watchers

James Cloos avatar Wesley Schwengle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.