{"id":22080451,"url":"https://github.com/msmesnik/adbm-rethinkdb","last_synced_at":"2025-07-25T06:08:34.999Z","repository":{"id":57173111,"uuid":"89358627","full_name":"msmesnik/adbm-rethinkdb","owner":"msmesnik","description":"RethinkDB adapter for adbm database migration tool","archived":false,"fork":false,"pushed_at":"2017-05-18T13:17:28.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-08T14:03:24.351Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/msmesnik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-25T12:35:25.000Z","updated_at":"2017-06-13T08:16:18.000Z","dependencies_parsed_at":"2022-08-24T13:31:02.929Z","dependency_job_id":null,"html_url":"https://github.com/msmesnik/adbm-rethinkdb","commit_stats":null,"previous_names":["daerion/adbm-rethinkdb"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/msmesnik/adbm-rethinkdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msmesnik%2Fadbm-rethinkdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msmesnik%2Fadbm-rethinkdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msmesnik%2Fadbm-rethinkdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msmesnik%2Fadbm-rethinkdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msmesnik","download_url":"https://codeload.github.com/msmesnik/adbm-rethinkdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msmesnik%2Fadbm-rethinkdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266963390,"owners_count":24013041,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"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":[],"created_at":"2024-11-30T23:14:22.573Z","updated_at":"2025-07-25T06:08:34.799Z","avatar_url":"https://github.com/msmesnik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# adbm-rethinkdb\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\nRethinkDB adapter for [adbm](https://github.com/daerion/adbm) database migration tool.\n\n## Installation\n```\nnpm install adbm-rethinkdb\n```\n\n## Helpers\nThis adapter contains a series of helper functions meant to simplify a few common migration tasks. These helper functions have been taken from the now deprecated [reconsider](https://github.com/daerion/reconsider) module, as has their documentation. Each of these functions will return a database migration object, i.e. an object exposing `up` and `down` methods, which can then be exported by the migration file.  \n                                                                                                                                                                                                                                                          \n### createTablesMigration\nThis function will return a migration that will create tables when migrating up and drop these tables when migrating down. `createTablesMigration` expects an array of table names.\n\n```js\n// In file migrations/xx-create-tables.js\nconst helpers = require('adbm-rethinkdb/helpers')\n\nmodule.exports = helpers.createTablesMigration([ 'first_table', 'second_table' ])\n````\n\n### createIndexMigration\nThis function will return a migration that will create indices when migrating up and drop these indices when migrating down. `createIndexMigration` expects an array of index specifications. Each index specification is an object containing a `table` and an `index` property, and optionally an `options` object and/or a `spec` function.\nAn `options` object can be anything that `r.indexCreate()` accepts, while the `spec` property must be a function that returns an index definition (which, again, can be anything that `r.indexCreate()` accepts). `spec` will be passed the rethinkdbdash instance when it is executed.\n\n```js\n// In file migrations/xx-create-indices.js\nconst helpers = require('adbm-rethinkdb/helpers')\nconst table = 'first_table'\n\nmodule.exports = helpers.createIndexMigration([\n  { table, index: 'someProp' }, // Simple index\n  { table, index: 'compoundIndex', spec: (r) =\u003e [ r.row('firstProp'), r.row('secondProp') ] }, // Compound index\n  { table, index: 'geoProp', options: { geo: true } }, // Geo index\n  { table, index: 'multiIndex', options: { multi: true } }, // Multi index\n  { table, index: 'arbitraryExpr', spec: (r) =\u003e (doc) =\u003e r.branch(doc.hasFields('foo'), doc('foo'), doc('bar')) } // Index based on an arbitrary expression\n])\n```\n\n## Testing\nRunning tests requires a rethinkdb database. You can either point the tests to your own rethinkdb server using environment variables (see below) or use the included `docker:db` npm script to spin up a docker container called `adbm_rethinkdb_dev_db` that will provide you with a basic rethinkdb server. After that, you'll simply want to:\n\n```\nnpm run test\n```\n\n### Environment Variables\n```js\nconst dbConfig = {\n  host: process.env.DB_HOST || 'localhost',\n  port: process.env.DB_PORT,\n  authKey: process.env.DB_AUTH_KEY,\n  db: process.env.DB_NAME || 'adbm_rethinkdb'\n}\n```\nI.e. when supplying no configuration, tests will attempt to connect to `localhost` on the default port and will attempt to use the `adbm_rethinkdb` database (which will be created if it does not already exist).\n\n## Author\n[Michael Smesnik](https://github.com/daerion) at [tailored apps](https://github.com/tailoredapps)\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsmesnik%2Fadbm-rethinkdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsmesnik%2Fadbm-rethinkdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsmesnik%2Fadbm-rethinkdb/lists"}