Created
May 16, 2012 09:14
-
-
Save pobo380/2708959 to your computer and use it in GitHub Desktop.
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
# coding: utf-8 | |
require 'rubygems' | |
require 'sequel' | |
## connect to database. | |
Sequel::Model.plugin(:schema) | |
DB = Sequel.sqlite('database.sqlite3') | |
## create a table. | |
class Person < Sequel::Model | |
unless table_exists? | |
set_schema do | |
primary_key :id | |
string :name | |
integer :age | |
end | |
create_table | |
end | |
end | |
Person.create(:name => 'Pamyu Pamyu', :age => 19) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment