GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ghas-results/sql_enum

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

47 Commits
47 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
bin
bin
 
 
gemfiles
gemfiles
 
 
lib
lib
 
 
spec
spec
 
 
.env
.env
 
 
.gitignore
.gitignore
 
 
.rspec
.rspec
 
 
.travis.yml
.travis.yml
 
 
Appraisals
Appraisals
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
Dockerfile
Dockerfile
 
 
Gemfile
Gemfile
 
 
Gemfile.lock
Gemfile.lock
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
docker-compose.yml
docker-compose.yml
 
 
sql_enum.gemspec
sql_enum.gemspec
 
 

Repository files navigation

SqlEnum

Enables usage of native sql enums with ActiveRecord

Installation

Add this line to your application's Gemfile:

gem 'sql_enum'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sql_enum

Usage

Migrations

Use a part of table definition:

class CreateUsers < ActiveRecord::Migration[5.1]
  def change
    create_table :users do |t|
      t.enum :status, limit: [:active, :pending, :inactive], default: :active

      t.timestamps
    end
  end
end

Or add an enum column:

add_column :users, :status, :enum, limit: [:active, :pending, :inactive], default: :active

ActiveRecord

class User < ActiveRecord::Base
  sql_enum :status
end

Development

Testing

Run docker-compose run --rm rspec to run the specs in a docker container alongside Mysql.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/1debit/sql_enum. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

Inspiration from native_enum

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the SqlEnum project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

No description or website provided.

Topics

1debit

Resources

Readme
License

Code of conduct

Code of conduct
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.