{"id":21846565,"url":"https://github.com/tidbcloud/branching-rails-example","last_synced_at":"2025-03-21T16:44:19.998Z","repository":{"id":198808448,"uuid":"698008438","full_name":"tidbcloud/branching-rails-example","owner":"tidbcloud","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-25T19:51:51.000Z","size":45,"stargazers_count":0,"open_issues_count":6,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-26T12:12:16.302Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidbcloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-29T00:07:21.000Z","updated_at":"2023-09-30T06:05:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"711e5dd1-14b1-486b-b125-943729af3818","html_url":"https://github.com/tidbcloud/branching-rails-example","commit_stats":null,"previous_names":["tidbcloud/branching-rails-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidbcloud%2Fbranching-rails-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidbcloud%2Fbranching-rails-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidbcloud%2Fbranching-rails-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidbcloud%2Fbranching-rails-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidbcloud","download_url":"https://codeload.github.com/tidbcloud/branching-rails-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244831060,"owners_count":20517620,"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":[],"created_at":"2024-11-27T23:14:27.430Z","updated_at":"2025-03-21T16:44:19.964Z","avatar_url":"https://github.com/tidbcloud.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# branching-rails-example\n\nFrom this repo, you can learn:\n\n- How to connect to TiDB Serverless in ruby on rails.\n- How to use branching GitHub integration.\n\n## About this repo\n\nThis repo is a rails blog example. it includes:\n\n- Articles CRUD based on [MVC](https://guides.rubyonrails.org/getting_started.html#mvc-and-you)\n- Migration and seed bases on [Active Record Migrations](https://guides.rubyonrails.org/active_record_migrations.html)\n\n\u003e The repo is based on the [blog tutorial](https://guides.rubyonrails.org/getting_started.html).\n\n## Connect to TiDB Serverless in ruby on rails\n\n\u003e Make sure you have installed the ruby and rails environment.\n\n1. clone the code\n\n```\ngit clone git@github.com:tidbcloud/branching-rails-example.git\ncd branching-rails-example\n```\n\n2. Install the dependencies\n\n```\nbundle install\n```\n\n3. Fill in the following environment variable defined in `config/database.yml`. You can find the information in the TiDB Serverless console.\n\n```\nexport TIDB_DATABASE=\nexport TIDB_USER=\nexport TIDB_HOST=\nexport TIDB_PASSWORD=\nexport TIDB_CERT_PATH=\n```\n\n4. Migrate and seed\n\n```\nrake db:migrate\nrake db:seed\n```\n\n5. Run the server\n\n```\nrails server\n```\n\n## Use branching GitHub integration\n\nAssume that you have run the rails project on a TiDB Serverless. Next, you can use the [Branching GitHub integration](https://docs.pingcap.com/tidbcloud/branch-github-integration) to connect the TiDB Serverless to this repo. Then a database branch will be created for every pull request to test the changes before merging the code to the master branch.\n\nThis repo has already connected to a TiDB Serverless. Check this [pull request](https://github.com/tidbcloud/branching-rails-example/pull/1) to see how we check the migration changes!\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidbcloud%2Fbranching-rails-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidbcloud%2Fbranching-rails-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidbcloud%2Fbranching-rails-example/lists"}