Last active
August 29, 2015 14:22
-
-
Save eval/4db895457e8b25c31037 to your computer and use it in GitHub Desktop.
Code along with http://devblog.avdi.org/2015/05/26/rubytapas-freebie-sequel/ (usage: get https://rubygems.org/gems/bundle-try, then: `bundle try rubytapas-sequel@https://gist.github.com/eval/4db895457e8b25c31037`)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gem::Specification.new do |s| | |
s.name = 'rubytapas-sequel' | |
s.description = 'Follow along with http://devblog.avdi.org/2015/05/26/rubytapas-freebie-sequel/' | |
s.version = '0.0.1' | |
s.require_path = '.' | |
s.add_dependency "sequel" | |
s.add_dependency "sqlite3" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sequel" | |
DB = Sequel.sqlite | |
DB.create_table :people do | |
primary_key :id | |
String :name | |
end | |
DB.create_table :items do | |
foreign_key :person_id, :people | |
String :name | |
Integer :quantity, default: 1 | |
unique [:person_id, :name] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment