{"id":13879095,"url":"https://github.com/fnando/ar-check","last_synced_at":"2025-04-16T22:50:29.238Z","repository":{"id":56522405,"uuid":"55840029","full_name":"fnando/ar-check","owner":"fnando","description":"Enable PostgreSQL's CHECK constraints on ActiveRecord migrations","archived":false,"fork":false,"pushed_at":"2020-11-02T17:49:57.000Z","size":25,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T16:50:27.388Z","etag":null,"topics":["activerecord","constraints","postgresql"],"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/fnando.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["fnando"],"custom":["https://www.paypal.me/nandovieira/🍕"]}},"created_at":"2016-04-09T11:11:45.000Z","updated_at":"2022-09-29T01:01:50.000Z","dependencies_parsed_at":"2022-08-15T20:20:23.531Z","dependency_job_id":null,"html_url":"https://github.com/fnando/ar-check","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Far-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Far-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Far-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Far-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnando","download_url":"https://codeload.github.com/fnando/ar-check/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249284459,"owners_count":21243964,"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":["activerecord","constraints","postgresql"],"created_at":"2024-08-06T08:02:09.689Z","updated_at":"2025-04-16T22:50:29.194Z","avatar_url":"https://github.com/fnando.png","language":"Ruby","readme":"# AR::Check\n\n[![Tests](https://github.com/fnando/ar-check/workflows/Tests/badge.svg)](https://github.com/fnando/ar-check/actions?query=workflow%3ATests)\n[![Code Climate](https://codeclimate.com/github/fnando/ar-check/badges/gpa.svg)](https://codeclimate.com/github/fnando/ar-check)\n[![Gem](https://img.shields.io/gem/v/ar-check.svg)](https://rubygems.org/gems/ar-check)\n[![Gem](https://img.shields.io/gem/dt/ar-check.svg)](https://rubygems.org/gems/ar-check)\n\nEnable PostgreSQL's CHECK constraints on ActiveRecord migrations.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"ar-check\"\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install ar-check\n\n## Usage\n\nTo create a `CHECK` constraint, just use the method `add_check`.\n\n```ruby\ncreate_table :employees do |t|\n  t.integer :salary, null: false\nend\n\nadd_check :employees, :positive_salary, \"salary \u003e 0\"\n```\n\nThis will generate a new constraint using the following SQL statement:\n\n```sql\nALTER TABLE employees\nADD CONSTRAINT positive_salary_on_things\nCHECK (salary \u003e 0)\n```\n\nTo remove it, just using `remove_check`.\n\n```ruby\nremove_check :employees, :positive_salary\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run\n`rake test` to run the tests. You can also run `bin/console` for an interactive\nprompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To\nrelease a new version, update the version number in `version.rb`, and then run\n`bundle exec rake release`, which will create a git tag for the version, push\ngit commits and tags, and push the `.gem` file to\n[rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/fnando/ar-check. This project is intended to be a safe,\nwelcoming space for collaboration, and contributors are expected to adhere to\nthe [Contributor Covenant](contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](http://opensource.org/licenses/MIT).\n","funding_links":["https://github.com/sponsors/fnando","https://www.paypal.me/nandovieira/🍕"],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Far-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnando%2Far-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Far-check/lists"}