karmi (owner)

Revisions

gist: 113414 Download_button fork
public
Public Clone URL: git://gist.github.com/113414.git
Embed All Files: show embed
sinatra_automigrate_ar.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
configure :development, :production do
  # Create database and schema for comments if not present
  begin
    ActiveRecord::Schema.define(:version => 1) do
      create_table :posts do |t|
        t.integer :id, :null => false
        t.string :title
        t.text :body
        t.datetime :created_at, :default => 'NOW()'
      end
    end
  rescue Exception => e
    puts e
  end unless Post.table_exists?
end