{"id":20791297,"url":"https://github.com/theprofs/row-mapper","last_synced_at":"2026-04-18T10:05:28.133Z","repository":{"id":78089239,"uuid":"122241742","full_name":"TheProfs/row-mapper","owner":"TheProfs","description":"Efficiently move/map/migrate rows between PostgreSQL database tables","archived":false,"fork":false,"pushed_at":"2018-02-21T15:34:20.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-29T08:34:04.095Z","etag":null,"topics":["data-conversion","event-sourcing","postgresql"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheProfs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-20T18:59:36.000Z","updated_at":"2018-02-21T15:33:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"55c783cb-6c8d-4904-960e-439dee46d412","html_url":"https://github.com/TheProfs/row-mapper","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":"0.040000000000000036","last_synced_commit":"1c74ea9880f4f63544b9f0db3b81fd940e76c67b"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/TheProfs/row-mapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Frow-mapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Frow-mapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Frow-mapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Frow-mapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheProfs","download_url":"https://codeload.github.com/TheProfs/row-mapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Frow-mapper/sbom","scorecard":{"id":140361,"data":{"date":"2025-08-04","repo":{"name":"github.com/TheProfs/row-mapper","commit":"1c74ea9880f4f63544b9f0db3b81fd940e76c67b"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":3.4,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'master'","Warn: could not determine whether codeowners review is allowed","Warn: no status checks found to merge onto branch 'master'","Warn: PRs are not required to make changes on branch 'master'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}}]},"last_synced_at":"2025-08-16T07:53:55.533Z","repository_id":78089239,"created_at":"2025-08-16T07:53:55.533Z","updated_at":"2025-08-16T07:53:55.533Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31964551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["data-conversion","event-sourcing","postgresql"],"created_at":"2024-11-17T15:43:07.250Z","updated_at":"2026-04-18T10:05:28.113Z","avatar_url":"https://github.com/TheProfs.png","language":"JavaScript","readme":"# row-mapper\n\n[![Build Status](https://travis-ci.org/TheProfs/row-mapper.svg?branch=master)](https://travis-ci.org/TheProfs/row-mapper)\n\nEfficiently move/map/migrate rows between PostgreSQL database tables.\n\n## Install\n\n```bash\n$ npm i row-mapper\n```\n\n## Use cases\n\n### Perform minimal downtime data migrations/conversions\n\nSuccessfully inserted/mapped rows are saved in a *cache*. When you start\nprocessing again, the module will skip processed rows and continue from the\nlast known succesful row.\n\nThe cache allows restarting the process from the last-succesful-point after a\nrun.\n\nIn a production system where minimal downtime is mandated you would:\n\n   1. Migrate/convert a sources table's rows to a target table.\n   2. Stop read/writes to the source table temporarily - i.e put app in\n      \"maintenance mode\".\n   3. Re-run the row-mapper to transfer the new rows that were inserted by\n      users while Step 1 was running.\n      The cache ensures that only new rows\n      are transferred from the source table.\n   4. Drop source table \u0026 rename target table as source table.\n   5. Re-enable read/writes to source table - i.e put app out of\n      \"maintenance mode\".\n\n\nThe cache also ensures the conversion is fault-tolerant. If your system\ncrashes while processing, you can simply restart the conversion from the last\nknown succesful point.\n\n### Convert big tables\n\nYou can convert huge tables. This module processes rows in *chunks*, so it\navoids a lot of network roundtrips whilst keeping memory usage low since it\ndoesn't load the whole table in-memory.\n\n## Usage\n\nAssume you have a table named `users` and you want to move all it's rows\nto another table named `archived_users` - which could reside in another\ndatabase.\n\nWhile you move the data you might also need to convert each row's data to\nanother format.\n\nHere's how you would do it:\n\n```javascript\n'use strict'\n\nconst RowMapper = require('row-mapper')\n\nconst mapper = new RowMapper({\n  // The source database\n  source: {\n    // DB settings\n    client: 'pg',\n    connection: {\n      host: '127.0.0.1',\n      user: 'foo',\n      password: 'bar_pass',\n      database: 'foo_db'\n    },\n\n    // The table to get data from.\n    table: {\n      name: 'users',\n      primaryKey: 'id_user'\n    }\n  },\n\n  /*\n    The target database, where data would be moved to.\n    - This can be the same as the source DB.\n   */\n  target: {\n    // DB settings\n    client: 'pg',\n    connection: {\n      host: '127.0.0.2',\n      user: 'foo',\n      password: 'foo_pass',\n      database: 'bar_db'\n    },\n\n    // The table to insert data to.\n    table: {\n      name: 'archived_users',\n      primaryKey: 'id_user',\n      /*\n        Name of the sequence associated with the primary key.\n        - Upon succesful completion, this sequence will be\n          set to the max value of the primary key column of the target table.\n       */\n      primaryKeySequence: 'user_id_user_seq'\n    }\n  },\n\n  // How many rows to process, per chunk. Defaults to 2000.\n  chunkSize: 3000,\n\n  /*\n    This mapper function will run for *each* row of the source table.\n    - You can convert each row here before you insert it to your target table.\n   */\n  mapperFn: (row, i) =\u003e {\n    return Object.assign(row, {\n      archived_date: new Date(),\n      archiver: 'John Doe'\n    }\n  }\n})\n\n// Then just run the mapper\nmapper.start().then(result =\u003e {\n  console.log('Success')\n})\n.catch(err =\u003e {\n  console.error(err)\n})\n```\n\n## Tests\n\n```bash\n$ npm test\n```\n\n**Important:** Tests are run against an in-memory SQLite database and do\nnot reset the table PK sequences after they are done.\n\n## Authors\n\n- [The Profs][the-profs-gh]\n\n## License\n\nMIT\n\n[the-profs-gh]: https://github.com/TheProfs\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheprofs%2Frow-mapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheprofs%2Frow-mapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheprofs%2Frow-mapper/lists"}