enju_event 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +36 -0
  4. data/app/controllers/calendar_controller.rb +34 -0
  5. data/app/controllers/event_categories_controller.rb +18 -0
  6. data/app/controllers/event_import_files_controller.rb +95 -0
  7. data/app/controllers/event_import_results_controller.rb +15 -0
  8. data/app/controllers/events_controller.rb +152 -0
  9. data/app/controllers/participates_controller.rb +81 -0
  10. data/app/helpers/calendar_helper.rb +31 -0
  11. data/app/models/event.rb +87 -0
  12. data/app/models/event_category.rb +23 -0
  13. data/app/models/event_import_file.rb +166 -0
  14. data/app/models/event_import_result.rb +23 -0
  15. data/app/models/participate.rb +25 -0
  16. data/app/views/calendar/index.html.erb +45 -0
  17. data/app/views/event_categories/_form.html.erb +19 -0
  18. data/app/views/event_categories/edit.html.erb +13 -0
  19. data/app/views/event_categories/index.html.erb +46 -0
  20. data/app/views/event_categories/new.html.erb +12 -0
  21. data/app/views/event_categories/show.html.erb +29 -0
  22. data/app/views/event_import_files/edit.html.erb +25 -0
  23. data/app/views/event_import_files/index.html.erb +40 -0
  24. data/app/views/event_import_files/new.html.erb +37 -0
  25. data/app/views/event_import_files/show.html.erb +64 -0
  26. data/app/views/event_import_results/index.csv.erb +3 -0
  27. data/app/views/event_import_results/index.html.erb +50 -0
  28. data/app/views/event_import_results/show.html.erb +33 -0
  29. data/app/views/events/_all_day.html.erb +24 -0
  30. data/app/views/events/_form.html.erb +44 -0
  31. data/app/views/events/edit.html.erb +14 -0
  32. data/app/views/events/index.atom.builder +10 -0
  33. data/app/views/events/index.csv.erb +4 -0
  34. data/app/views/events/index.html.erb +105 -0
  35. data/app/views/events/index.ics.erb +13 -0
  36. data/app/views/events/index.mobile.erb +49 -0
  37. data/app/views/events/index.rss.builder +34 -0
  38. data/app/views/events/new.html.erb +17 -0
  39. data/app/views/events/show.html.erb +50 -0
  40. data/app/views/events/show.mobile.erb +42 -0
  41. data/app/views/participates/edit.html.erb +28 -0
  42. data/app/views/participates/index.html.erb +30 -0
  43. data/app/views/participates/new.html.erb +27 -0
  44. data/app/views/participates/show.html.erb +24 -0
  45. data/config/routes.rb +10 -0
  46. data/db/fixtures/event_categories.yml +13 -0
  47. data/db/migrate/113_create_events.rb +23 -0
  48. data/db/migrate/114_create_event_categories.rb +16 -0
  49. data/db/migrate/20081028093607_create_event_import_files.rb +29 -0
  50. data/db/migrate/20090519203307_create_participates.rb +17 -0
  51. data/db/migrate/20100925074639_create_event_import_results.rb +15 -0
  52. data/lib/enju_event.rb +5 -0
  53. data/lib/enju_event/engine.rb +18 -0
  54. data/lib/enju_event/version.rb +3 -0
  55. data/lib/tasks/enju_event_tasks.rake +5 -0
  56. data/spec/controllers/event_categories_controller_spec.rb +483 -0
  57. data/spec/controllers/event_import_files_controller_spec.rb +321 -0
  58. data/spec/controllers/events_controller_spec.rb +506 -0
  59. data/spec/dummy/Rakefile +7 -0
  60. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  61. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  62. data/spec/dummy/app/controllers/application_controller.rb +99 -0
  63. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  64. data/spec/dummy/app/mailers/notifier.rb +28 -0
  65. data/spec/dummy/app/models/ability.rb +39 -0
  66. data/spec/dummy/app/models/language.rb +4 -0
  67. data/spec/dummy/app/models/library.rb +128 -0
  68. data/spec/dummy/app/models/library_group.rb +86 -0
  69. data/spec/dummy/app/models/patron.rb +163 -0
  70. data/spec/dummy/app/models/patron_type.rb +19 -0
  71. data/spec/dummy/app/models/role.rb +8 -0
  72. data/spec/dummy/app/models/shelf.rb +54 -0
  73. data/spec/dummy/app/models/user.rb +43 -0
  74. data/spec/dummy/app/models/user_group.rb +2 -0
  75. data/spec/dummy/app/models/user_has_role.rb +4 -0
  76. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  77. data/spec/dummy/app/views/page/403.html.erb +9 -0
  78. data/spec/dummy/app/views/page/403.mobile.erb +5 -0
  79. data/spec/dummy/app/views/page/403.xml.erb +4 -0
  80. data/spec/dummy/app/views/page/404.html.erb +9 -0
  81. data/spec/dummy/app/views/page/404.mobile.erb +5 -0
  82. data/spec/dummy/app/views/page/404.xml.erb +4 -0
  83. data/spec/dummy/config.ru +4 -0
  84. data/spec/dummy/config/application.rb +45 -0
  85. data/spec/dummy/config/boot.rb +10 -0
  86. data/spec/dummy/config/database.yml +25 -0
  87. data/spec/dummy/config/environment.rb +5 -0
  88. data/spec/dummy/config/environments/development.rb +30 -0
  89. data/spec/dummy/config/environments/production.rb +60 -0
  90. data/spec/dummy/config/environments/test.rb +39 -0
  91. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  92. data/spec/dummy/config/initializers/devise.rb +209 -0
  93. data/spec/dummy/config/initializers/inflections.rb +10 -0
  94. data/spec/dummy/config/initializers/mime_types.rb +7 -0
  95. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  96. data/spec/dummy/config/initializers/session_store.rb +8 -0
  97. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  98. data/spec/dummy/config/locales/en.yml +5 -0
  99. data/spec/dummy/config/routes.rb +60 -0
  100. data/spec/dummy/db/migrate/001_create_patrons.rb +62 -0
  101. data/spec/dummy/db/migrate/059_create_libraries.rb +34 -0
  102. data/spec/dummy/db/migrate/069_create_shelves.rb +19 -0
  103. data/spec/dummy/db/migrate/080_create_library_groups.rb +25 -0
  104. data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +16 -0
  105. data/spec/dummy/db/migrate/20081025083905_create_languages.rb +27 -0
  106. data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
  107. data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +9 -0
  108. data/spec/dummy/db/migrate/20100527113752_create_delayed_jobs.rb +21 -0
  109. data/spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb +9 -0
  110. data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
  111. data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +11 -0
  112. data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
  113. data/spec/dummy/db/migrate/20111201155456_create_users.rb +14 -0
  114. data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +31 -0
  115. data/spec/dummy/db/migrate/20111201163342_create_user_groups.rb +12 -0
  116. data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
  117. data/spec/dummy/db/schema.rb +293 -0
  118. data/spec/dummy/db/test.sqlite3 +0 -0
  119. data/spec/dummy/lib/enju_leaf.rb +4 -0
  120. data/spec/dummy/lib/enju_leaf/import_file.rb +13 -0
  121. data/spec/dummy/lib/enju_leaf/localized_name.rb +13 -0
  122. data/spec/dummy/lib/enju_leaf/master_model.rb +41 -0
  123. data/spec/dummy/lib/enju_leaf/url_validator.rb +10 -0
  124. data/spec/dummy/log/sunspot-solr-test.log +222 -0
  125. data/spec/dummy/log/test.log +145759 -0
  126. data/spec/dummy/private/system/event_imports/4/original/event_import_file_sample1.tsv +5 -0
  127. data/spec/dummy/private/system/event_imports/4/original/event_import_file_sample2.tsv +3 -0
  128. data/spec/dummy/public/404.html +26 -0
  129. data/spec/dummy/public/422.html +26 -0
  130. data/spec/dummy/public/500.html +26 -0
  131. data/spec/dummy/public/favicon.ico +0 -0
  132. data/spec/dummy/script/rails +6 -0
  133. data/spec/dummy/solr/conf/admin-extra.html +31 -0
  134. data/spec/dummy/solr/conf/elevate.xml +36 -0
  135. data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  136. data/spec/dummy/solr/conf/protwords.txt +21 -0
  137. data/spec/dummy/solr/conf/schema.xml +238 -0
  138. data/spec/dummy/solr/conf/scripts.conf +24 -0
  139. data/spec/dummy/solr/conf/solrconfig.xml +934 -0
  140. data/spec/dummy/solr/conf/spellings.txt +2 -0
  141. data/spec/dummy/solr/conf/stopwords.txt +58 -0
  142. data/spec/dummy/solr/conf/synonyms.txt +31 -0
  143. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  144. data/spec/dummy/solr/data/test/index/segments_1 +0 -0
  145. data/spec/dummy/solr/data/test/spellchecker/segments.gen +0 -0
  146. data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
  147. data/spec/factories/event.rb +7 -0
  148. data/spec/factories/event_category.rb +5 -0
  149. data/spec/factories/library.rb +13 -0
  150. data/spec/factories/user.rb +34 -0
  151. data/spec/fixtures/event_categories.yml +55 -0
  152. data/spec/fixtures/event_import_files.yml +49 -0
  153. data/spec/fixtures/event_import_results.yml +24 -0
  154. data/spec/fixtures/events.yml +142 -0
  155. data/spec/fixtures/languages.yml +1901 -0
  156. data/spec/fixtures/libraries.yml +108 -0
  157. data/spec/fixtures/library_groups.yml +34 -0
  158. data/spec/fixtures/patron_types.yml +35 -0
  159. data/spec/fixtures/patrons.yml +338 -0
  160. data/spec/fixtures/roles.yml +21 -0
  161. data/spec/fixtures/shelves.yml +46 -0
  162. data/spec/fixtures/user_groups.yml +25 -0
  163. data/spec/fixtures/user_has_roles.yml +41 -0
  164. data/spec/fixtures/users.yml +69 -0
  165. data/spec/models/event_category_spec.rb +21 -0
  166. data/spec/models/event_import_file_spec.rb +62 -0
  167. data/spec/models/event_import_result_spec.rb +20 -0
  168. data/spec/models/event_spec.rb +39 -0
  169. data/spec/spec_helper.rb +45 -0
  170. data/spec/support/controller_macros.rb +48 -0
  171. data/spec/support/devise.rb +4 -0
  172. metadata +541 -0
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
6
+ Mime::Type.register_alias "text/html", :mobile
7
+ Mime::Type.register "application/octet-stream", :download
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '9e365175b4255ddc2772a096bc9926017d8ad7a16a56970fe1db7ef57ae19776178228e20899dd3ba1726d29ca5c8075e168a243a06fc776788cbc5afc5525a2'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,60 @@
1
+ Dummy::Application.routes.draw do
2
+ devise_for :users
3
+
4
+ # The priority is based upon order of creation:
5
+ # first created -> highest priority.
6
+
7
+ # Sample of regular route:
8
+ # match 'products/:id' => 'catalog#view'
9
+ # Keep in mind you can assign values other than :controller and :action
10
+
11
+ # Sample of named route:
12
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
13
+ # This route can be invoked with purchase_url(:id => product.id)
14
+
15
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
16
+ # resources :products
17
+
18
+ # Sample resource route with options:
19
+ # resources :products do
20
+ # member do
21
+ # get 'short'
22
+ # post 'toggle'
23
+ # end
24
+ #
25
+ # collection do
26
+ # get 'sold'
27
+ # end
28
+ # end
29
+
30
+ # Sample resource route with sub-resources:
31
+ # resources :products do
32
+ # resources :comments, :sales
33
+ # resource :seller
34
+ # end
35
+
36
+ # Sample resource route with more complex sub-resources
37
+ # resources :products do
38
+ # resources :comments
39
+ # resources :sales do
40
+ # get 'recent', :on => :collection
41
+ # end
42
+ # end
43
+
44
+ # Sample resource route within a namespace:
45
+ # namespace :admin do
46
+ # # Directs /admin/products/* to Admin::ProductsController
47
+ # # (app/controllers/admin/products_controller.rb)
48
+ # resources :products
49
+ # end
50
+
51
+ # You can have the root of your site routed with "root"
52
+ # just remember to delete public/index.html.
53
+ # root :to => 'welcome#index'
54
+
55
+ # See how all your routes lay out with "rake routes"
56
+
57
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
58
+ # Note: This route will make all actions in every controller accessible via GET requests.
59
+ # match ':controller(/:action(/:id(.:format)))'
60
+ end
@@ -0,0 +1,62 @@
1
+ class CreatePatrons < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :patrons do |t|
4
+ t.integer :user_id
5
+ t.string :last_name
6
+ t.string :middle_name
7
+ t.string :first_name
8
+ t.string :last_name_transcription
9
+ t.string :middle_name_transcription
10
+ t.string :first_name_transcription
11
+ t.string :corporate_name
12
+ t.string :corporate_name_transcription
13
+ t.string :full_name
14
+ t.text :full_name_transcription
15
+ t.text :full_name_alternative
16
+ t.timestamps
17
+ t.datetime :deleted_at
18
+ t.string :zip_code_1
19
+ t.string :zip_code_2
20
+ t.text :address_1
21
+ t.text :address_2
22
+ t.text :address_1_note
23
+ t.text :address_2_note
24
+ t.string :telephone_number_1
25
+ t.string :telephone_number_2
26
+ t.string :fax_number_1
27
+ t.string :fax_number_2
28
+ t.text :other_designation
29
+ t.text :place
30
+ t.string :postal_code
31
+ t.text :street
32
+ t.text :locality
33
+ t.text :region
34
+ t.datetime :date_of_birth
35
+ t.datetime :date_of_death
36
+ t.integer :language_id, :default => 1, :null => false
37
+ t.integer :country_id, :default => 1, :null => false
38
+ t.integer :patron_type_id, :default => 1, :null => false
39
+ t.integer :lock_version, :default => 0, :null => false
40
+ t.text :note
41
+ t.integer :creates_count, :default => 0, :null => false
42
+ t.integer :realizes_count, :default => 0, :null => false
43
+ t.integer :produces_count, :default => 0, :null => false
44
+ t.integer :owns_count, :default => 0, :null => false
45
+ #t.integer :resource_has_subjects_count, :default => 0, :null => false
46
+ t.integer :required_role_id, :default => 1, :null => false
47
+ t.integer :required_score, :default => 0, :null => false
48
+ t.string :state
49
+ t.text :email
50
+ t.text :url
51
+ end
52
+ add_index :patrons, :user_id, :unique => true
53
+ add_index :patrons, :language_id
54
+ add_index :patrons, :country_id
55
+ add_index :patrons, :required_role_id
56
+ add_index :patrons, :full_name
57
+ end
58
+
59
+ def self.down
60
+ drop_table :patrons
61
+ end
62
+ end
@@ -0,0 +1,34 @@
1
+ class CreateLibraries < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :libraries do |t|
4
+ t.references :patron, :polymorphic => true
5
+ t.string :name, :null => false
6
+ t.text :display_name
7
+ t.string :short_display_name, :null => false
8
+ t.string :zip_code
9
+ t.text :street
10
+ t.text :locality
11
+ t.text :region
12
+ t.string :telephone_number_1
13
+ t.string :telephone_number_2
14
+ t.string :fax_number
15
+ t.text :note
16
+ t.integer :call_number_rows, :default => 1, :null => false
17
+ t.string :call_number_delimiter, :default => "|", :null => false
18
+ t.integer :library_group_id, :default => 1, :null => false
19
+ t.integer :users_count, :default => 0, :null => false
20
+ t.integer :position
21
+ t.integer :country_id
22
+
23
+ t.timestamps
24
+ t.datetime :deleted_at
25
+ end
26
+ add_index :libraries, :patron_id, :unique => true
27
+ add_index :libraries, :library_group_id
28
+ add_index :libraries, :name, :unique => true
29
+ end
30
+
31
+ def self.down
32
+ drop_table :libraries
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ class CreateShelves < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :shelves do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :library_id, :default => 1, :null => false
8
+ t.integer :items_count, :default => 0, :null => false
9
+ t.integer :position
10
+ t.timestamps
11
+ t.datetime :deleted_at
12
+ end
13
+ add_index :shelves, :library_id
14
+ end
15
+
16
+ def self.down
17
+ drop_table :shelves
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ class CreateLibraryGroups < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :library_groups do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.string :short_name, :null => false
7
+ t.string :email
8
+ t.text :my_networks
9
+ t.boolean :use_dsbl, :default => false, :null => false
10
+ t.text :dsbl_list
11
+ t.text :login_banner
12
+ t.text :note
13
+ t.integer :valid_period_for_new_user, :default => 365, :null => false
14
+ t.boolean :post_to_union_catalog, :default => false, :null => false
15
+ t.integer :country_id
16
+
17
+ t.timestamps
18
+ end
19
+ add_index :library_groups, :short_name
20
+ end
21
+
22
+ def self.down
23
+ drop_table :library_groups
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ class CreatePatronTypes < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :patron_types do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :patron_types
15
+ end
16
+ end
@@ -0,0 +1,27 @@
1
+ class CreateLanguages < ActiveRecord::Migration
2
+
3
+ # ISO 639 is the set of international standards that lists short codes for language names.
4
+ # Note this doesn't include macrolanguages (dialects)
5
+ # Information on macrolanguages http://en.wikipedia.org/wiki/ISO_639_macrolanguage
6
+
7
+ def self.up
8
+ create_table :languages do |t|
9
+ t.string :name, :null => false
10
+ t.string :native_name
11
+ t.text :display_name
12
+ t.string :iso_639_1, :size => 3
13
+ t.string :iso_639_2, :size => 3
14
+ t.string :iso_639_3, :size => 3
15
+ t.text :note
16
+ t.integer :position
17
+ end
18
+ add_index :languages, :name, :unique => true
19
+ add_index :languages, :iso_639_1
20
+ add_index :languages, :iso_639_2
21
+ add_index :languages, :iso_639_3
22
+ end
23
+
24
+ def self.down
25
+ drop_table :languages
26
+ end
27
+ end
@@ -0,0 +1,9 @@
1
+ class AddAdminNetworksToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :admin_networks, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :admin_networks
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddAllowBookmarkExternalUrlToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :allow_bookmark_external_url, :boolean, :null => false, :default => false
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :allow_bookmark_external_url
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ class CreateDelayedJobs < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :delayed_jobs, :force => true do |table|
4
+ table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
5
+ table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
6
+ table.text :handler # YAML-encoded string of the object that will do work
7
+ table.text :last_error # reason for last failure (See Note below)
8
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
9
+ table.datetime :locked_at # Set when a client is working on this object
10
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
11
+ table.string :locked_by # Who is working on this object (if locked)
12
+ table.timestamps
13
+ end
14
+
15
+ add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
16
+ end
17
+
18
+ def self.down
19
+ drop_table :delayed_jobs
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ class AddPositionToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :position, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :position
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddUrlToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :url, :string, :default => 'http://localhost:3000/'
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :url
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class RemoveDsblFromLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ remove_column :library_groups, :use_dsbl
4
+ remove_column :library_groups, :dsbl_list
5
+ end
6
+
7
+ def down
8
+ add_column :library_groups, :dsbl_list, :text
9
+ add_column :library_groups, :use_dsbl, :boolean
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ class CreateRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table :roles do |t|
4
+ t.string :name
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.integer :user_group_id
5
+ t.integer :required_role_id
6
+ t.string :username
7
+ t.text :note
8
+ t.string :locale
9
+ t.string :user_number
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,31 @@
1
+ class AddDeviseToUsers < ActiveRecord::Migration
2
+ def self.up
3
+ change_table(:users) do |t|
4
+ t.database_authenticatable :null => false
5
+ t.recoverable
6
+ t.rememberable
7
+ t.trackable
8
+
9
+ # t.encryptable
10
+ # t.confirmable
11
+ # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
12
+ # t.token_authenticatable
13
+
14
+
15
+ # Uncomment below if timestamps were not included in your original model.
16
+ # t.timestamps
17
+ end
18
+
19
+ add_index :users, :email #, :unique => true
20
+ add_index :users, :reset_password_token, :unique => true
21
+ # add_index :users, :confirmation_token, :unique => true
22
+ # add_index :users, :unlock_token, :unique => true
23
+ # add_index :users, :authentication_token, :unique => true
24
+ end
25
+
26
+ def self.down
27
+ # By default, we don't want to make any assumption about how to roll back a migration when your
28
+ # model already existed. Please edit below which fields you would like to remove in this migration.
29
+ raise ActiveRecord::IrreversibleMigration
30
+ end
31
+ end