{"id":21492564,"url":"https://github.com/societe-generale/code2pg","last_synced_at":"2025-07-15T18:30:38.028Z","repository":{"id":48484312,"uuid":"107136652","full_name":"societe-generale/code2pg","owner":"societe-generale","description":"Tool to help migrate application code from Oracle to PostgreSQL","archived":false,"fork":false,"pushed_at":"2023-01-02T09:12:21.000Z","size":742,"stargazers_count":24,"open_issues_count":5,"forks_count":10,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-10-30T18:32:43.208Z","etag":null,"topics":["migration","oracle","perl","postgresql","source-code","sql"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/societe-generale.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-16T14:11:44.000Z","updated_at":"2023-02-05T21:08:09.000Z","dependencies_parsed_at":"2023-02-01T02:16:31.399Z","dependency_job_id":null,"html_url":"https://github.com/societe-generale/code2pg","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/societe-generale%2Fcode2pg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/societe-generale%2Fcode2pg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/societe-generale%2Fcode2pg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/societe-generale%2Fcode2pg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/societe-generale","download_url":"https://codeload.github.com/societe-generale/code2pg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226061663,"owners_count":17567708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["migration","oracle","perl","postgresql","source-code","sql"],"created_at":"2024-11-23T15:30:01.558Z","updated_at":"2024-11-23T15:30:05.058Z","avatar_url":"https://github.com/societe-generale.png","language":"Perl","readme":"code2pg\n=======\n\n\u003cimg src=\"./doc/logo_code _2_pg.png\" width=\"120\"\u003e\n\n\nWhat is code2pg ?\n--------------\n\n`code2pg` is a tool that help migrating application code that contains SQL queries from Oracle to PostgreSQL standard.\n\nIt can:\n- estimate in man-days how difficult a migration will be for application code (in Java files for example);\n- tag the source file for Oracle instructions that might need to be migrated;\n- generate different reports: html, text or minimal;\n- connect directly to a SVN repository or use local files;\n- be tuned according to the team's expertise.\n\nPrerequisites :\n-------------\n\n`code2pg` is a standalone script. It requires Perl \u003e= 5.20 and the `File::Slurp`, `File::Find::Rule`, `List::MoreUtils`, `Getopt::Long` and `Config::General` Perl modules. They can be obtained either from a CPAN client or from your distribution.\n\nOn a Centos 7(+) box, it can be installed this way:\n\n```\nsudo yum install perl-File-Slurp perl-File-Find-Rule perl-Config-General perl-List-MoreUtils perl-Getopt-Long\n```\n\nOn a Debian box, the packages could be installed with:\n\n```\nsudo apt-get install libfile-slurp-perl libfile-find-rule-perl libconfig-general-perl liblist-moreutils-perl libgetopt-mixed-perl\n```\n\nWith the cpan minus client, the prerequisites can be installed this way:\n\n```\ncpanm File::Slurp File::Find::Rule List::MoreUtils Getopt::Long Config::General\n```\n\nThe script has been tested very lightly on Windows with Strawberry Perl (v5.24.3) with the proper modules installed (the CPAN client can be used for this). A warning is issued though as `wc` is usually not recognized.\n\nInstallation\n------------\n\n```\ngit clone https://github.com/societe-generale/code2pg\n```\n\nThe script should then be made executable:\n\n```\nchmod +x code2pg\n```\n\nUsage\n-----\n\nPlease refer to the complete [generated documentation](https://github.com/societe-generale/code2pg/blob/master/doc/code2pg.pod) for more details. Here are a few examples:\n\n- show the command line options of the tool:\n```\n./code2pg --help\n```\n- get some help on a specific instruction. The output is in markdown format:\n```\n./code2pg --help COMMIT\n```\n- get some help on all available instructions and generate a pdf file :\n```\n./code2pg --help ALL_INSTRUCTIONS | pandoc -f markdown -o myfile.pdf\n```\n- analyze files in the current directory with an extension .java and generate an estimation.html report. SQL instructions will have to searched in comma delimited strings:\n```\n./code2pg -e java -l comma-strings\n```\n- analyze java, jsp and .properties files in the current directory. This will so far need two reports as Oracle instructions will need to be analyzed in comma delimited strings, but directly in .properties files:\n```\n./code2pg -e java -e jsp -l comma-strings -o myproject_java.html\n./code2pg -e properties -l plain -o myproject_properties.html\n```\n- analyze plsql files in two directories with extension .properties and generate a named html report. When SQL files must be analyzed directly (such as pl/sql or .properties files), please configure the language as \"plain\". For other languages, Oracle instructions will be searched between string delimiters.\n```\n./code2pg -e properties -l plain -d /tmp/project1 -d /tmp/project2 -o project_estimate.html\n```\n- analyze java files in a SVN repository and generate a text report:\n```\n./code2pg -D svn -d https://mysvnrepo/project/trunk -l comma-strings -e java -f txt\n```\n- use a configuration file\n```\n./code2pg -c code2pg.conf\n```\n\nReport examples\n---------------\n\n- minimal output:\n\n```\nDone !\nEstimation: 0.19 man-days\n```\n\n- text output:\n\n```\nSettings\n========\n\n- Version code2pg: 0.13.0\n- Analysis date: 29/04/2019\n- Source code directory: /home/user/migration-project/\n- Number of .java files: 76\n- Language: comma-strings\n- Number of analyzed LOC: 0\n- Log file: \n- orafce usage: No\n\nEstimates\n=========\n\n|            | Number of instructions | Time/instruction | Estimated time (minutes) | Man-days |\n|------------|------------------------|------------------|--------------------------|----------|\n| Level 1    |                    265 |                1 |                      265 |      0.7 |\n| Level 2    |                     27 |                4 |                      108 |      0.3 |\n| Level 3    |                     26 |                8 |                      208 |      0.6 |\n| Level 4    |                    140 |               20 |                     2800 |      7.8 |\n| estimation |                    458 |              7.4 |                     3381 |      9.4 |\n\nInstructions\n============\n\n| Level | Instruction          | Number |\n|-------|----------------------|--------|\n|     1 |                ASCII |     60 |\n|     1 |                COUNT |     11 |\n|     1 |                LOWER |    178 |\n|     1 |                  MAX |      4 |\n|     1 |                  MIN |      9 |\n|     1 |                UPPER |      3 |\n|     2 |                  NVL |      8 |\n|     2 |                  SUM |     17 |\n|     2 |            TO_NUMBER |      2 |\n|     3 |                 CAST |      1 |\n|     3 |               DECODE |     20 |\n|     3 |                HINTS |      4 |\n|     3 |               ROWNUM |      1 |\n|     4 |              CONVERT |    140 |\n```\n\n- html output: \n\n![code2pg html output screenshot](doc/code2pg_report_html.jpg)\n\n- help output:\n````\nADD_MONTHS\n==========\n\nORACLE\n------\n\n- Instruction: ADD_MONTHS\n- Documentation: http://docs.oracle.com/database/121/SQLRF/functions011.htm\n\nPOSTGRESQL\n-----------\n\n- Postgresql instruction: No equivalent\n- Documentation: \n- Level 3 - estimated time : 8 minutes.\n\nCOMMENTS\n---------\n\nA function can be created. For example: \n```\nCREATE OR REPLACE FUNCTION public.add_months(date date, months integer)\n RETURNS date\n LANGUAGE plpgsql\nAS $function$\nBEGIN\nRETURN (date + (months * '1 month' :: interval)) :: date;\nEND;\n$function$\n```\n````\n\nHow to contribute?\n------------------\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md)\n\nLicense\n--------\nLicense is under the 2-Clause BSD License.  \n[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](LICENSE.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsociete-generale%2Fcode2pg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsociete-generale%2Fcode2pg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsociete-generale%2Fcode2pg/lists"}