{"id":27651889,"url":"https://github.com/aman5438/db_helper","last_synced_at":"2026-04-11T07:43:31.232Z","repository":{"id":289233762,"uuid":"970562387","full_name":"aman5438/db_helper","owner":"aman5438","description":"A lightweight Ruby gem to simplify database operations using ActiveRecord – check tables, create tables, insert data dynamically, and support multiple adapters (MySQL, PostgreSQL, SQLite).","archived":false,"fork":false,"pushed_at":"2025-04-22T07:49:30.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T05:00:04.997Z","etag":null,"topics":["activerecord","database","gem","mysql","postgresql","ruby","utility-gem"],"latest_commit_sha":null,"homepage":"","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/aman5438.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2025-04-22T07:43:04.000Z","updated_at":"2025-04-22T07:52:56.000Z","dependencies_parsed_at":"2025-04-22T08:54:03.826Z","dependency_job_id":null,"html_url":"https://github.com/aman5438/db_helper","commit_stats":null,"previous_names":["aman5438/db_helper"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aman5438/db_helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aman5438%2Fdb_helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aman5438%2Fdb_helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aman5438%2Fdb_helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aman5438%2Fdb_helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aman5438","download_url":"https://codeload.github.com/aman5438/db_helper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aman5438%2Fdb_helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31673067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"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":["activerecord","database","gem","mysql","postgresql","ruby","utility-gem"],"created_at":"2025-04-24T05:00:03.414Z","updated_at":"2026-04-11T07:43:31.200Z","avatar_url":"https://github.com/aman5438.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":" Installation\n Add this line to your application's Gemfile:\n gem 'db_helper', git: 'https://github.com/yourname/db_helper' # or use gem version if published\n\nthen run\nbundle install\nor install manually\ngem install db_helper\n\nUsage\n1. Check Adapter Type\n  DbHelper.adapter\n  # =\u003e :sqlite3 or :mysql2 or :postgresql\n2. Check if a Table Exists\n  DbHelper.table_exists?(\"users\")\n  # =\u003e true or false\n3. Create a Table (if it doesn't exist)\n  DbHelper.create_table(\"users\", {\n    name: :string,\n    email: :string\n  })\n  This will create a users table with name, email, and timestamps.\n\n4. Insert Data Dynamically\n  DbHelper.dynamic_insert(\"users\", {\n    name: \"John Doe\",\n    email: \"john@example.com\"\n  })\n  The table must exist before inserting.\n\n5. Get Current Database Name\n  DbHelper.current_database\n  # =\u003e \"db_helper_test\" or \":memory:\" etc.\n\nTesting the Gem\nTo run tests:\n  bundle exec rspec\nUse environment variables to test with different databases:\n  DB_ADAPTER=mysql2 DATABASE_NAME=db_helper_test USERNAME=root PASSWORD=root bundle exec rspec\n\nDirectory Structure\n  db_helper/\n  ├── lib/\n  │   ├── db_helper.rb\n  │   └── db_helper/version.rb\n  ├── spec/\n  │   └── db_helper_spec.rb\n  ├── db_helper.gemspec\n  └── README.md\n  \nFuture Improvements\nAdd support for schema migrations\n\nSupport validations on dynamic inserts\n\nAdd more DB introspection helpers\n\n👤 Author\nAman Agrawal","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faman5438%2Fdb_helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faman5438%2Fdb_helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faman5438%2Fdb_helper/lists"}