Guest User

Untitled

a guest
May 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. require "rubygems"
  2. require "bundler"
  3. Bundler.setup
  4.  
  5. require "active_support"
  6. require "active_record"
  7. require "action_view"
  8. require "rack"
  9. $:.unshift File.expand_path(File.dirname(__FILE__) + "/..")
  10. require "lib/more_paginate"
  11. load "init.rb"
  12. require "spec/fixtures"
  13.  
  14. def create_tables
  15. ActiveRecord::Migration.verbose = false
  16. ActiveRecord::Schema.define do
  17. create_table :events, :force => true do |t|
  18. t.string :identifier
  19. t.string :name
  20. t.date :start_on
  21.  
  22. t.timestamps
  23. end
  24.  
  25. create_table :people, :force => true do |t|
  26. t.string :identifier
  27. t.string :name
  28.  
  29. t.timestamps
  30. end
  31.  
  32. create_table :events_people, :force => true, :id => false do |t|
  33. t.references :event
  34. t.references :person
  35. end
  36.  
  37. create_table :photos, :force => true do |t|
  38. t.references :event
  39. t.string :identifier
  40. t.string :title
  41.  
  42. t.timestamps
  43. end
  44.  
  45. create_table :tags, :force => true do |t|
  46. t.string :identifier
  47. t.string :name
  48.  
  49. t.timestamps
  50. end
  51.  
  52. create_table :taggings, :force => true do |t|
  53. t.references :taggable, :polymorphic => true
  54. t.references :tag
  55.  
  56. t.timestamps
  57. end
  58. end
  59. end
  60.  
  61. ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ":memory:"
  62. ActiveRecord::Base.logger = ActiveSupport::BufferedLogger.new "log/database.log"
  63. create_tables
Add Comment
Please, Sign In to add comment