Skip to content

Embed the new column according to the desired position in any table in the postgresql database.

Notifications You must be signed in to change notification settings

rafaelsagastume/pgreshape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgreshape

Embed the new column according to the desired position in any table in the postgresql database.

Why pgreshape?

It helps you to generate an sql script that looks for the dependencies of the table to be able to embed the new column, these dependencies are found recursively :-) Then recreate the table supporting you in the reconstruction of the original structure.

 ----                                    ----
| id |                                  | id |
 ----                                    ----
 ----                                    ----
| c1 |                                  | c1 |
 ----                                    ----
 ----                ----                ----
| c2 |              |newc|              |newc|
 ----                ----                ----
 ----     -> pgreshape (file.sql) ->     ----
| c3 |          offset = c1             | c2 |
 ----                                    ----
 ----                                    ----
| c4 |                                  | c3 |
 ----                                    ----
                                         ----
                                        | c4 |
                                         ----

support:

Table dependencies
Object Support Comments
Columns partial
ACL on Columns complete
Comment complete
Index complete
Sequence partial
Foreign Key complete
Unique constraint complete
Check constraint complete
Exclude constraint complete
Views recursive complete
ACL on View complete

requirements:

Global
$ git
$ gcc
$ cmake
$ make

Ubuntu 16.04 +
$ postgresql
$ postgresql-client
$ postgresql-contrib
$ postgresql-server-dev
$ libpq-dev

ArchLinux
$ postgresql
$ postgresql-libs

compile:

$ git clone https://github.com/rafaelsagastume/pgreshape.git
$ cd pgreshape
$ cmake .
$ make

install:

$ sudo make install

update:

$ git pull origin master
$ make clean && make
$ sudo make install

reshape.conf:

host = localhost
port = 5432
dbname = db1
user = postgres
password = 123
file = /tmp/file.sql

example:

pgreshape -c /opt/reshape.conf -s rrhh -t expediente -offset emisor -column nueva -type 'boolean' -file /tmp/file-other.sql

About

Embed the new column according to the desired position in any table in the postgresql database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published