Can ActiveRecord create tables outside of a migration?
Posted
by Munkymorgy
on Stack Overflow
See other posts from Stack Overflow
or by Munkymorgy
Published on 2010-03-01T20:36:11Z
Indexed on
2010/04/03
8:13 UTC
Read the original article
Hit count: 389
I am working on a non Rails web app, so no migrations script by default.
The Sequel ORM lets me create tables easily in a script:
#!/usr/bin/env ruby
require 'rubygems'
require 'sequel'
## Connect to the database
DB = Sequel.sqlite('./ex1.db')
unless DB.table_exists? :posts
DB.create_table :posts do
primary_key :id
varchar :title
text :body
end
end
Is there a way todo this with ActiveRecord outside of migrations?
© Stack Overflow or respective owner