Skip to content

Instantly share code, notes, and snippets.

@pobo380
Created May 16, 2012 09:14
Show Gist options
  • Save pobo380/2708959 to your computer and use it in GitHub Desktop.
Save pobo380/2708959 to your computer and use it in GitHub Desktop.
# 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