begin ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") rescue ArgumentError ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:") end ActiveRecord::Base.configurations = true ActiveRecord::Schema.define(:version => 1) do create_table :layouts, :force => true do |t| t.text :description t.string :name t.string :path # path to the layout, same as the 'render' method t.string :key # some layouts use same views, but have different sub areas t.timestamps end create_table :areas, :force => true do |t| t.string :name t.references :layout t.timestamps end create_table :widgets, :force => true do |t| t.string :name t.references :area t.string :type t.timestamps end create_table :links, :force => true do |t| t.string :name t.timestamps end create_table :pages, :force => true do |t| t.string :title t.timestamps end create_table :relationships do |t| t.references :parent, :polymorphic => true t.references :child, :polymorphic => true t.string :context t.timestamps end end