{"id":17585021,"url":"https://github.com/tommeier/bootstrap-db","last_synced_at":"2025-09-06T16:41:54.746Z","repository":{"id":9375375,"uuid":"11232952","full_name":"tommeier/bootstrap-db","owner":"tommeier","description":"Rails tasks for loading and creating database snapshots quickly","archived":false,"fork":false,"pushed_at":"2014-07-25T07:51:02.000Z","size":616,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-07T10:15:16.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/tommeier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-07T12:12:24.000Z","updated_at":"2014-06-06T07:01:05.000Z","dependencies_parsed_at":"2022-08-19T16:50:07.883Z","dependency_job_id":null,"html_url":"https://github.com/tommeier/bootstrap-db","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tommeier/bootstrap-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommeier%2Fbootstrap-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommeier%2Fbootstrap-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommeier%2Fbootstrap-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommeier%2Fbootstrap-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tommeier","download_url":"https://codeload.github.com/tommeier/bootstrap-db/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommeier%2Fbootstrap-db/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273933515,"owners_count":25193599,"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-09-06T02:00:13.247Z","response_time":2576,"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-10-22T02:23:52.640Z","updated_at":"2025-09-06T16:41:54.721Z","avatar_url":"https://github.com/tommeier.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bootstrap-DB\n\n## Purpose\n\nTo be able to load and dump a database as quickly as possible.\nPrimary use is to load a large dataset quickly, with practical applications for running\ntest suites (with extensive seed data).\n\nSome projects require extensive seed data, with many complex values, which can take excessive time to generate. The idea of this project is to create a 'snapshot' in time of this generated seed data, and be able to load almost instantly. With the time rebase task, this can also have the time and dates rebased to the current time, allowing relative time tests to work.\n\nFor example:\n * Running a project with multiple customer types and scenarios, with complex underlying data. This takes around ~55 seconds to generate. You don't want to run this for *every single test* you run. So on change of the data, recreate the dump, and set the test suite to load. Now it will take ~1 second.\n\n## Add this line to your application's Gemfile:\n\n```\n  gem 'bootstrap-db'\n```\n\n## Commands (with example usage)\n\n### Database Dump\n\n```\n  rake bootstrap:db:dump                                          #Dump default to db/bootstrap/bootstrap_data.sql\n  rake bootstrap:db:dump RAILS_ENV=production                     #Dump specific Rails environment using database.yml\n  rake bootstrap:db:dump BOOTSTRAP_DIR=db/my_bootstraps/          #Dump to specific directory\n  rake bootstrap:db:dump FILE_NAME=live_database.dump             #Dump specific file to default bootstrap location\n```\n\n#### Additional options:\n\n  * Dump file with comma delimited tables ignored:\n```\n  rake bootstrap:db:dump IGNORE_TABLES='messages,incidents'\n```\n\n### Database Rebuild and Dump\n\nRecreate the database from scratch, seed and then dump.\n\n```\n  rake bootstrap:db:recreate                                      #Dump default to db/bootstrap/bootstrap_data.sql\n```\n\n### Database Load\n\nLoad, and overwrite, current database environment with a passed file name.\n\n```\n  rake bootstrap:db:load                                          #Load default from db/bootstrap/bootstrap_data.sql\n  rake bootstrap:db:load RAILS_ENV=production                     #Load specific Rails environment using database.yml\n  rake bootstrap:db:load BOOTSTRAP_DIR=db/custom_dir/             #Load from specific dump directory\n  rake bootstrap:db:load FILE_NAME=live_database_dump.sql         #Load specific file from default bootstrap location\n```\n\n### Additional options:\n\nPass in any additional parameters that your database accepts:\n  * eg. mysqldump *--help* / pg_dump *--help*\n\n```\n  rake bootstrap:db:dump ADDITIONAL_PARAMS='-d,-t'\n  rake bootstrap:db:load ADDITIONAL_PARAMS='-d,-t'\n```\n\nPass 'VERBOSE=true' if you'd like to see more information. For example:\n\n```\n  rake bootstrap:db:dump VERBOSE=true\n```\n\n### Database Time Rebaser\n\nLoad, and overwrite, current database environment with a passed snapshot. Then 'rebase' all date and time values from the generated snapshot point in time to 'now'.\n\nWorking example:\n * A customer may have an activity feed with a variety of tests to check date ranges of results. With the `time rebaser` task, this will actively loop over every date or time value in a db and `rebase` the time to a new point (comparing it to the generated time).\n * For this to work, you can only use *relative* time tests (1.week.ago, 4.months.ago, 5.years.from.now), as the rebaser doesn't know what should be fixed and not. You cannot generate data (and snapshot the dump) with data like `Time.zone.today.beginning_of_year` and expect the test to find the data. *All* date and time fields will be shifted based on the difference between when the data was generated and the load time.\n\n\n*all the same options as `bootstrap:db:load` apply here too*\n```\n  rake bootstrap:db:load_and_rebase           #Load default from db/bootstrap/bootstrap_data.sql and rebase all time and date values\n```\n\n## Requirements\n\n * Rails\n * config/database.yml exists and set correctly\n * database.yml has a 'host' value set for environments\n * mysql/postgresql\n\n\n## TODO\n  * Write extensive readme examples\n  * This has been quickly rebuilt from a ridiculously old project of mine (http://github.com/tommeier/bootstrap). This should be refactored into proper objects and expose classes as well as rake tasks. Fully tested.\n  * List required attributes for each database (like `host` and raise on missing)\n  * Clearly list options available to Rake tasks\n  * Convert rake tasks to script tasks (if 'load_config' can be loaded)\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Create some tests\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommeier%2Fbootstrap-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommeier%2Fbootstrap-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommeier%2Fbootstrap-db/lists"}