{"id":15441541,"url":"https://github.com/steveoro/goggles_db","last_synced_at":"2025-09-10T17:32:10.356Z","repository":{"id":39673486,"uuid":"293578999","full_name":"steveoro/goggles_db","owner":"steveoro","description":"DB structure and base Rails models for the main Goggles application","archived":false,"fork":false,"pushed_at":"2024-04-08T19:11:21.000Z","size":44873,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-08T22:19:01.255Z","etag":null,"topics":["database","goggles","sports","swimming"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steveoro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":"steveoro","open_collective":"master-goggles","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://paypal.me/StefanoAlloro"]}},"created_at":"2020-09-07T16:30:55.000Z","updated_at":"2024-04-15T13:03:56.980Z","dependencies_parsed_at":"2024-04-15T13:03:11.927Z","dependency_job_id":null,"html_url":"https://github.com/steveoro/goggles_db","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steveoro%2Fgoggles_db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steveoro%2Fgoggles_db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steveoro%2Fgoggles_db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steveoro%2Fgoggles_db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steveoro","download_url":"https://codeload.github.com/steveoro/goggles_db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232548607,"owners_count":18540145,"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":["database","goggles","sports","swimming"],"created_at":"2024-10-01T19:20:57.703Z","updated_at":"2025-01-05T04:56:26.499Z","avatar_url":"https://github.com/steveoro.png","language":"Ruby","funding_links":["https://patreon.com/steveoro","https://opencollective.com/master-goggles","https://paypal.me/StefanoAlloro"],"categories":[],"sub_categories":[],"readme":"# GogglesDb README\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/steveoro/goggles_db/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/steveoro/goggles_db/tree/master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/ba9e005076a6aa97f788/maintainability)](https://codeclimate.com/github/steveoro/goggles_db/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/ba9e005076a6aa97f788/test_coverage)](https://codeclimate.com/github/steveoro/goggles_db/test_coverage)\n[![codecov](https://codecov.io/gh/steveoro/goggles_db/branch/master/graph/badge.svg?token=G4E7NVC4T4)](https://codecov.io/gh/steveoro/goggles_db)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsteveoro%2Fgoggles_db.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsteveoro%2Fgoggles_db?ref=badge_shield)\n\n\nDB structure and base Rails models for the Goggles Framework applications.\nIncludes the [Devise](https://github.com/heartcombo/devise) routes for `User` (the Engine must be mounted in `routes.rb` in order to publish them).\n\n\n## Wiki \u0026 HOW-TOs\n\nOfficial Framework Wiki, [here](https://github.com/steveoro/goggles_db/wiki) (v. 7+)\n\n\n## Requires\n\n- Ruby 3.1.4\n- Rails 6.1.7.9+\n- MariaDb 15.1 dist. 10.6.16+ or any other MySql equivalent version\n\n\n\n## Installation\n\nJust clone the repository on `localhost` and run `bundle install`.\n\nTo recreate the DB, see [Database setup](#database-setup) below.\n\n\n## Usage\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'goggles_db', git: 'https://github.com/steveoro/goggles_db'\n```\n\nThis gem uses [Git LFS](https://git-lfs.github.com/) to store the `test` DB dump file. When updating the gem from inside any sub-project that uses it, you'll need to skip the DB dump file download with:\n\n```bash\n$\u003e GIT_LFS_SKIP_SMUDGE=1 bundle update goggles_db\n```\n\nThe Engine will add a bunch of rake tasks to the application, among which:\n\n- `db:dump` \u0026 `db:rebuild` will assume the existence of an SQL dump file named after the target environment (format `\u003cENVIRONMENT_NAME\u003e.sql.bz2`); this gem includes an anonymized `test` dump under the dummy app folder that mounts this namespaced engine, inside the `spec/dummy/db/dump` folder. Check out [Database setup](#database-setup) below.\n\n- `check_needed_dirs` will be invoked internally by these tasks to ensure the existence of any other required folder.\n\n\n\n## How to run the test suite\n\nFor local testing \u0026 development, just keep your [Guard](https://github.com/guard/guard) friend running in background from a dedicated console:\n\n```bash\n$\u003e guard\n```\n\nWhenever you want to run the full test suite just hit Enter on the Guard console.\n\nJust to be sure, although the Guard plugin for Brakeman runs correctly at start, it's always better to re-run a `brakeman` full check before pushing the changes to the repository:\n\n```bash\n$\u003e bundle exec brakeman -Aq\n```\n\n_Please, make sure the test suite is locally :green_heart: before committing \u0026 pushing any changes to the repo._\n\n\n\n## Database setup\n\nMake sure you have a running MariaDB server \u0026 client installation + development packages in order to rebuild the drivers during `bundle install`.\n\nTo speed up the build process, the test suite uses pre-existing anonymized data seeds with **transactional fixtures** and _does not clear the DB before each run_.\n\nFor this reason, you'll need a proper DB dump from which restore the DB for either running tests or for using a localhost server during development.\n\n\n### DB management tasks\n\nThe tasks added by GogglesDb deal mostly with its DB setup and management. (When called from the project root, in the context of an unmounted Engine, you need to prefix the tasks with `app:`)\n\n- (`app:`)`db:dump`: dumps current Rails environment DB inside the `db/dump` folder. When using the unmounted Engine by itself, the target context of the dumps is the default test-`dummy` app subfolder. The result of this task will be an un-namespaced, compressed, SQL file dump: no database name prefixes on any DDL statements and no `USE` or `CREATE database` statements in it.\n\n- (`app:`)`db:rebuild`: restores any valid `*.sql.bz2` dump file found stored in `db/dump`. Again, provided the dump image is structured as above: without any DB namespaces in it (as those created by `db:dump` typically are).\n\nTo rebuild the `test` database before running the suite (using default parameter values given by the current environment) just run:\n\n```bash\n$\u003e RAILS_ENV=test rails app:db:rebuild\n```\n\n\n_Any other target DB_ can be prepared for local usage by copying a source dump to another target.\n\nFor example, if you need to work with the `development` environment, you can easily prepare it with the anonymized `test` image:\n\n```bash\n$\u003e rails app:db:rebuild from=test to=development\n```\n\n(The execution will take some time depending of the dump size: sit back and relax...)\n\n\n### From scratch\n\nA brand new DB image (for any environment) can be built by force-loading the SQL structure file after resetting the current DB and then running the factories for each entity you may need:\n\n```bash\n$\u003e rails db:reset\n$\u003e rails structure:load\n```\n\nThen, you'll have to use the Factories (`spec/factories`) to create each individual fixture.\n\nTo mount the factories from the Rails console:\n\n```ruby\n \u003e FactoryBot.definition_file_paths \u003c\u003c \"#{GogglesDb::Engine.root}/spec/factories\"\n \u003e FactoryBot.reload\n```\n\nTo create a brand new random user (for example):\n\n```ruby\n \u003e FactoryBot.create(:user)\n```\n\n\n* * *\n\n\n## Contributing\n1. Clone the project.\n2. Make a new custom branch for your changes, naming the branch accordingly (i.e. use prefixes like: `feature-`, `fix-`, `upgrade-`, ...).\n3. When you think you're done, make sure you type `guard` (+`Enter`) and wait for the whole spec suite to end.\n4. Make sure your branch is locally green (:green_heart:) before submitting the pull request.\n5. Await the PR's review by the maintainers.\n\n\n## License\nThe gem is available as open source under the terms of the [LGPL-3.0 License](https://opensource.org/licenses/LGPL-3.0).\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsteveoro%2Fgoggles_db.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsteveoro%2Fgoggles_db?ref=badge_large)\n\n\n\n## Supporting\n\nCheck out the \"sponsor\" button at the top of the page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteveoro%2Fgoggles_db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteveoro%2Fgoggles_db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteveoro%2Fgoggles_db/lists"}