enju_bookmark 0.1.2.pre17 → 0.1.2.pre18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/bookmark.rb +12 -12
  3. data/lib/enju_bookmark/engine.rb +1 -0
  4. data/lib/enju_bookmark/manifestation.rb +4 -4
  5. data/lib/enju_bookmark/version.rb +1 -1
  6. data/spec/controllers/bookmark_stats_controller_spec.rb +4 -4
  7. data/spec/dummy/config/boot.rb +2 -2
  8. data/spec/dummy/config/initializers/friendly_id.rb +90 -0
  9. data/spec/dummy/db/development.sqlite3 +0 -0
  10. data/spec/dummy/db/migrate/005_create_manifestations.rb +0 -1
  11. data/spec/dummy/db/migrate/029_create_subjects.rb +27 -0
  12. data/spec/dummy/db/migrate/035_create_reserves.rb +1 -2
  13. data/spec/dummy/db/migrate/059_create_libraries.rb +5 -1
  14. data/spec/dummy/db/migrate/069_create_shelves.rb +5 -1
  15. data/spec/dummy/db/migrate/077_create_user_groups.rb +7 -3
  16. data/spec/dummy/db/migrate/080_create_library_groups.rb +6 -1
  17. data/spec/dummy/db/migrate/113_create_events.rb +23 -0
  18. data/spec/dummy/db/migrate/114_create_event_categories.rb +16 -0
  19. data/spec/dummy/db/migrate/130_create_request_status_types.rb +5 -1
  20. data/spec/dummy/db/migrate/131_create_request_types.rb +5 -1
  21. data/spec/dummy/db/migrate/133_create_agent_merges.rb +15 -0
  22. data/spec/dummy/db/migrate/134_create_agent_merge_lists.rb +13 -0
  23. data/spec/dummy/db/migrate/142_create_classifications.rb +19 -0
  24. data/spec/dummy/db/migrate/144_create_classification_types.rb +16 -0
  25. data/spec/dummy/db/migrate/145_create_subject_heading_types.rb +16 -0
  26. data/spec/dummy/db/migrate/146_create_subject_types.rb +16 -0
  27. data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
  28. data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
  29. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
  30. data/spec/dummy/db/migrate/20081212080038_create_manifestation_checkout_stats.rb +0 -1
  31. data/spec/dummy/db/migrate/20081215094302_create_user_checkout_stats.rb +0 -1
  32. data/spec/dummy/db/migrate/20081216190724_create_manifestation_reserve_stats.rb +0 -1
  33. data/spec/dummy/db/migrate/20081220023628_create_user_reserve_stats.rb +0 -1
  34. data/spec/dummy/db/migrate/20090321130448_add_completed_at_to_user_checkout_stat.rb +0 -4
  35. data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +1 -1
  36. data/spec/dummy/db/migrate/20100925074559_create_agent_import_results.rb +0 -1
  37. data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +1 -1
  38. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
  39. data/spec/dummy/db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb +11 -0
  40. data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
  41. data/spec/dummy/db/migrate/{20111201155513_add_devise_to_users.rb → 20111201155456_devise_create_users.rb} +9 -17
  42. data/spec/dummy/db/migrate/{20100606065209_create_user_has_roles.rb → 20111201163718_create_user_has_roles.rb} +0 -2
  43. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
  44. data/spec/dummy/db/migrate/20120224094141_create_delayed_jobs.rb +22 -0
  45. data/spec/dummy/db/migrate/20120406020752_add_url_to_subject.rb +5 -0
  46. data/spec/dummy/db/migrate/20130303124821_add_retained_at_to_reserve.rb +5 -0
  47. data/spec/dummy/db/migrate/20130304015019_add_postponed_at_to_reserve.rb +5 -0
  48. data/spec/dummy/db/migrate/20130416054135_add_circulation_status_id_to_item.rb +8 -0
  49. data/spec/dummy/db/migrate/20130504133816_add_manifestation_id_to_subject.rb +6 -0
  50. data/spec/dummy/db/migrate/20130504143515_add_manifestation_id_to_classification.rb +6 -0
  51. data/spec/dummy/db/migrate/20130504195916_add_subject_heading_type_id_to_subject.rb +5 -0
  52. data/spec/dummy/db/migrate/20130519065638_add_lock_version_to_reserve.rb +5 -0
  53. data/spec/dummy/db/migrate/20130519065837_add_lock_version_to_checkin.rb +5 -0
  54. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +1 -1
  55. data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +14 -0
  56. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +14 -0
  57. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +14 -0
  58. data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +14 -0
  59. data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +14 -0
  60. data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +14 -0
  61. data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +14 -0
  62. data/spec/dummy/db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb +12 -0
  63. data/spec/dummy/db/migrate/20140810091231_add_checkout_icalendar_token_to_profile.rb +6 -0
  64. data/spec/dummy/db/migrate/20140810091417_add_save_checkout_history_to_profile.rb +5 -0
  65. data/spec/dummy/db/migrate/20140811031145_add_expired_at_to_profile.rb +5 -0
  66. data/spec/dummy/db/migrate/20140813182425_add_publication_place_to_manifestation.rb +5 -0
  67. data/spec/dummy/db/migrate/20140822114527_add_error_message_to_resource_import_result.rb +5 -0
  68. data/spec/dummy/db/migrate/20140823083524_add_extent_to_manifestation.rb +5 -0
  69. data/spec/dummy/db/migrate/20140823094847_add_dimensions_to_manifestation.rb +5 -0
  70. data/spec/dummy/db/migrate/20140823095740_rename_manifestation_periodical_to_serial.rb +9 -0
  71. data/spec/dummy/db/schema.rb +828 -565
  72. data/spec/dummy/db/test.sqlite3 +0 -0
  73. data/spec/dummy/solr/default/data/index/segments.gen +0 -0
  74. data/spec/dummy/solr/default/data/index/segments_1vs +0 -0
  75. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002429 +0 -0
  76. data/spec/dummy/solr/default/data/tlog/{tlog.0000000000000000300 → tlog.0000000000000002430} +0 -0
  77. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002431 +0 -0
  78. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002432 +0 -0
  79. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002433 +0 -0
  80. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002434 +0 -0
  81. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002435 +0 -0
  82. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002436 +0 -0
  83. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002437 +0 -0
  84. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002438 +0 -0
  85. data/spec/fixtures/checkout_types.yml +34 -0
  86. data/spec/fixtures/circulation_statuses.yml +120 -0
  87. data/spec/fixtures/manifestations.yml +5 -5
  88. data/spec/fixtures/users.yml +1 -1
  89. metadata +145 -49
  90. data/spec/dummy/db/migrate/041_create_roles.rb +0 -13
  91. data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -8
  92. data/spec/dummy/solr/default/data/index/segments_8m +0 -0
  93. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000299 +0 -0
  94. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000301 +0 -0
  95. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000302 +0 -0
  96. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000303 +0 -0
  97. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000304 +0 -0
  98. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000305 +0 -0
  99. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000306 +0 -0
  100. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000307 +0 -0
  101. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000308 +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4031e53377a5b374cae891279b2acb473bac213b
4
- data.tar.gz: 9aa31c3842d048200b82b536d08fbc824d1edf3e
3
+ metadata.gz: db479211c5aa5bcee491d61771df0b9b65534259
4
+ data.tar.gz: 3e33b0aae96bed63858a2cec5c308dc5a854fa00
5
5
  SHA512:
6
- metadata.gz: cdfeee9e63f02d0e4c7f8d95a9029bd45b561daddae34fc80f6707578cf2ab4781eafd538b4ad736d4bb48c080b3f0574b54f7c5e4f5ca787ce88cb3680d44c2
7
- data.tar.gz: 8fb4108f903b0560d15e4e24dbfe3f81e090613d4926fdeb26e4be93c6c86f0f79e19f4ab2b12ba1cdbd99bf09b6e3f08891ca69af9d4bb85e476722f9e2d7fa
6
+ metadata.gz: fa7fa8ff67ff51148cf927b5da4cbbff9f9dc5d9f99407b2fe25c5c0b4ce385f53f283c59b2cdc023cbedbcb3f36235e21be47655701cea953dfa867f346a8af
7
+ data.tar.gz: 6814f8e114f61b0867df640ab89b5eae1683f8594b91dd182cda2a9d4c79e9c4af94db6b4c862bf349311d5eceea2a710b3acf24ed4ec022fd773f139857b6ad
@@ -1,21 +1,21 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  class Bookmark < ActiveRecord::Base
3
3
  attr_accessible :title, :url, :note, :shared, :tag_list
4
- scope :bookmarked, lambda {|start_date, end_date| {:conditions => ['created_at >= ? AND created_at < ?', start_date, end_date]}}
5
- scope :user_bookmarks, lambda {|user| where(:user_id => user.id)}
6
- scope :shared, where(:shared => true)
4
+ scope :bookmarked, lambda {|start_date, end_date| where('created_at >= ? AND created_at < ?', start_date, end_date)}
5
+ scope :user_bookmarks, lambda {|user| where(user_id: user.id)}
6
+ scope :shared, where(shared: true)
7
7
  belongs_to :manifestation, touch: true
8
- belongs_to :user #, :counter_cache => true, validate: true
8
+ belongs_to :user #, counter_cache: true, validate: true
9
9
 
10
10
  validates_presence_of :user, :title
11
11
  validates_presence_of :url, on: :create
12
12
  validates_presence_of :manifestation_id, on: :update
13
13
  validates_associated :user, :manifestation
14
14
  validates_uniqueness_of :manifestation_id, scope: :user_id
15
- validates :url, url: true, presence: true, length: {:maximum => 255}
15
+ validates :url, url: true, presence: true, length: {maximum: 255}
16
16
  validate :bookmarkable_url?
17
- validate :already_bookmarked?, :if => :url_changed?
18
- before_save :create_manifestation, :if => :url_changed?
17
+ validate :already_bookmarked?, if: :url_changed?
18
+ before_save :create_manifestation, if: :url_changed?
19
19
  before_save :replace_space_in_tags
20
20
 
21
21
  acts_as_taggable_on :tags
@@ -76,7 +76,7 @@ class Bookmark < ActiveRecord::Base
76
76
  end
77
77
  unless manifestation
78
78
  normalized_url = Addressable::URI.parse(url).normalize.to_s
79
- doc = Nokogiri::HTML(open(normalized_url).read)
79
+ doc = Nokogiri::HTML(Faraday.get(normalized_url).body)
80
80
  # TODO: 日本語以外
81
81
  #charsets = ['iso-2022-jp', 'euc-jp', 'shift_jis', 'iso-8859-1']
82
82
  #if charsets.include?(page.charset.downcase)
@@ -96,7 +96,7 @@ class Bookmark < ActiveRecord::Base
96
96
  end
97
97
 
98
98
  def self.get_canonical_url(url)
99
- doc = Nokogiri::HTML(open(url))
99
+ doc = Nokogiri::HTML(Faraday.get(url).body)
100
100
  canonical_url = doc.search("/html/head/link[@rel='canonical']").first['href']
101
101
  # TODO: URLを相対指定している時
102
102
  Addressable::URI.parse(canonical_url).normalize.to_s
@@ -126,7 +126,7 @@ class Bookmark < ActiveRecord::Base
126
126
  if url.try(:my_host?)
127
127
  manifestation = self.my_host_resource
128
128
  else
129
- manifestation = Manifestation.where(:access_address => url).first if url.present?
129
+ manifestation = Manifestation.where(access_address: url).first if url.present?
130
130
  end
131
131
  end
132
132
 
@@ -144,7 +144,7 @@ class Bookmark < ActiveRecord::Base
144
144
  self.manifestation_id = manifestation.id
145
145
  return
146
146
  end
147
- manifestation = Manifestation.new(:access_address => url)
147
+ manifestation = Manifestation.new(access_address: url)
148
148
  manifestation.carrier_type = CarrierType.where(name: 'file').first
149
149
  if title.present?
150
150
  manifestation.original_title = title
@@ -170,7 +170,7 @@ class Bookmark < ActiveRecord::Base
170
170
 
171
171
  def self.manifestations_count(start_date, end_date, manifestation)
172
172
  if manifestation
173
- self.bookmarked(start_date, end_date).where(:manifestation_id => manifestation.id).count
173
+ self.bookmarked(start_date, end_date).where(manifestation_id: manifestation.id).count
174
174
  else
175
175
  0
176
176
  end
@@ -2,6 +2,7 @@ require 'enju_seed'
2
2
  require 'acts-as-taggable-on'
3
3
  require 'statesman'
4
4
  require 'addressable/uri'
5
+ require 'faraday'
5
6
  require 'nkf'
6
7
 
7
8
  module EnjuBookmark
@@ -7,11 +7,11 @@ module EnjuBookmark
7
7
  module ClassMethods
8
8
  def enju_bookmark_manifestation_model
9
9
  include InstanceMethods
10
- has_many :bookmarks, :include => :tags, :dependent => :destroy, :foreign_key => :manifestation_id
11
- has_many :users, :through => :bookmarks
10
+ has_many :bookmarks, dependent: :destroy, foreign_key: :manifestation_id
11
+ has_many :users, through: :bookmarks
12
12
 
13
13
  searchable do
14
- string :tag, :multiple => true do
14
+ string :tag, multiple: true do
15
15
  bookmarks.map{|bookmark| bookmark.tag_list}.flatten
16
16
  end
17
17
  text :tag do
@@ -23,7 +23,7 @@ module EnjuBookmark
23
23
 
24
24
  module InstanceMethods
25
25
  def bookmarked?(user)
26
- return true if user.bookmarks.where(:url => url).first
26
+ return true if user.bookmarks.where(url: url).first
27
27
  false
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  module EnjuBookmark
2
- VERSION = "0.1.2.pre17"
2
+ VERSION = "0.1.2.pre18"
3
3
  end
@@ -15,7 +15,7 @@ describe BookmarkStatsController do
15
15
 
16
16
  it "assigns all bookmark_stats as @bookmark_stats" do
17
17
  get :index
18
- expect(assigns(:bookmark_stats)).to eq(BookmarkStat.all)
18
+ expect(assigns(:bookmark_stats)).to eq(BookmarkStat.page(1))
19
19
  end
20
20
  end
21
21
 
@@ -24,7 +24,7 @@ describe BookmarkStatsController do
24
24
 
25
25
  it "assigns all bookmark_stats as @bookmark_stats" do
26
26
  get :index
27
- expect(assigns(:bookmark_stats)).to eq(BookmarkStat.all)
27
+ expect(assigns(:bookmark_stats)).to eq(BookmarkStat.page(1))
28
28
  end
29
29
  end
30
30
 
@@ -33,14 +33,14 @@ describe BookmarkStatsController do
33
33
 
34
34
  it "assigns all bookmark_stats as @bookmark_stats" do
35
35
  get :index
36
- expect(assigns(:bookmark_stats)).to eq(BookmarkStat.all)
36
+ expect(assigns(:bookmark_stats)).to eq(BookmarkStat.page(1))
37
37
  end
38
38
  end
39
39
 
40
40
  describe "When not logged in" do
41
41
  it "should not assign bookmark_stats as @bookmark_stats" do
42
42
  get :index
43
- expect(assigns(:bookmark_stats)).to eq(BookmarkStat.all)
43
+ expect(assigns(:bookmark_stats)).to eq(BookmarkStat.page(1))
44
44
  end
45
45
  end
46
46
  end
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
2
+ gemfile = ENV['BUNDLE_GEMFILE'] || File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
4
  if File.exist?(gemfile)
5
5
  ENV['BUNDLE_GEMFILE'] = gemfile
@@ -7,4 +7,4 @@ if File.exist?(gemfile)
7
7
  Bundler.setup
8
8
  end
9
9
 
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,90 @@
1
+ # FriendlyId Global Configuration
2
+ #
3
+ # Use this to set up shared configuration options for your entire application.
4
+ # Any of the configuration options shown here can also be applied to single
5
+ # models by passing arguments to the `friendly_id` class method or defining
6
+ # methods in your model.
7
+ #
8
+ # To learn more, check out the guide:
9
+ #
10
+ # http://norman.github.io/friendly_id/file.Guide.html
11
+
12
+ if Rails::VERSION::MAJOR == 4
13
+ FriendlyId.defaults do |config|
14
+ # ## Reserved Words
15
+ #
16
+ # Some words could conflict with Rails's routes when used as slugs, or are
17
+ # undesirable to allow as slugs. Edit this list as needed for your app.
18
+ config.use :reserved
19
+
20
+ config.reserved_words = %w(new edit index session login logout users admin
21
+ stylesheets assets javascripts images)
22
+
23
+ # ## Friendly Finders
24
+ #
25
+ # Uncomment this to use friendly finders in all models. By default, if
26
+ # you wish to find a record by its friendly id, you must do:
27
+ #
28
+ # MyModel.friendly.find('foo')
29
+ #
30
+ # If you uncomment this, you can do:
31
+ #
32
+ # MyModel.find('foo')
33
+ #
34
+ # This is significantly more convenient but may not be appropriate for
35
+ # all applications, so you must explicity opt-in to this behavior. You can
36
+ # always also configure it on a per-model basis if you prefer.
37
+ #
38
+ # Something else to consider is that using the :finders addon boosts
39
+ # performance because it will avoid Rails-internal code that makes runtime
40
+ # calls to `Module.extend`.
41
+ #
42
+ config.use :finders
43
+ #
44
+ # ## Slugs
45
+ #
46
+ # Most applications will use the :slugged module everywhere. If you wish
47
+ # to do so, uncomment the following line.
48
+ #
49
+ # config.use :slugged
50
+ #
51
+ # By default, FriendlyId's :slugged addon expects the slug column to be named
52
+ # 'slug', but you can change it if you wish.
53
+ #
54
+ # config.slug_column = 'slug'
55
+ #
56
+ # When FriendlyId can not generate a unique ID from your base method, it appends
57
+ # a UUID, separated by a single dash. You can configure the character used as the
58
+ # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
59
+ # with two dashes.
60
+ #
61
+ # config.sequence_separator = '-'
62
+ #
63
+ # ## Tips and Tricks
64
+ #
65
+ # ### Controlling when slugs are generated
66
+ #
67
+ # As of FriendlyId 5.0, new slugs are generated only when the slug field is
68
+ # nil, but if you're using a column as your base method can change this
69
+ # behavior by overriding the `should_generate_new_friendly_id` method that
70
+ # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
71
+ # more like 4.0.
72
+ #
73
+ # config.use Module.new {
74
+ # def should_generate_new_friendly_id?
75
+ # slug.blank? || <your_column_name_here>_changed?
76
+ # end
77
+ # }
78
+ #
79
+ # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
80
+ # languages that don't use the Roman alphabet, that's not usually suffient. Here
81
+ # we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If
82
+ # you use this, don't forget to add "babosa" to your Gemfile.
83
+ #
84
+ # config.use Module.new {
85
+ # def normalize_friendly_id(text)
86
+ # text.to_slug.normalize! :transliterations => [:russian, :latin]
87
+ # end
88
+ # }
89
+ end
90
+ end
Binary file
@@ -13,7 +13,6 @@ class CreateManifestations < ActiveRecord::Migration
13
13
  t.string :access_address
14
14
  t.integer :language_id, :default => 1, :null => false
15
15
  t.integer :carrier_type_id, :default => 1, :null => false
16
- t.integer :extent_id, :default => 1, :null => false
17
16
  t.integer :start_page
18
17
  t.integer :end_page
19
18
  t.integer :height
@@ -0,0 +1,27 @@
1
+ class CreateSubjects < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :subjects do |t|
4
+ t.integer :parent_id
5
+ t.integer :use_term_id
6
+ t.string :term
7
+ t.text :term_transcription
8
+ t.integer :subject_type_id, :null => false
9
+ t.text :scope_note
10
+ t.text :note
11
+ t.integer :required_role_id, :default => 1, :null => false
12
+ t.integer :lock_version, :default => 0, :null => false
13
+ t.datetime :created_at
14
+ t.datetime :updated_at
15
+ t.datetime :deleted_at
16
+ end
17
+ add_index :subjects, :term
18
+ add_index :subjects, :parent_id
19
+ add_index :subjects, :use_term_id
20
+ add_index :subjects, :subject_type_id
21
+ add_index :subjects, :required_role_id
22
+ end
23
+
24
+ def self.down
25
+ drop_table :subjects
26
+ end
27
+ end
@@ -10,8 +10,7 @@ class CreateReserves < ActiveRecord::Migration
10
10
  t.datetime :canceled_at
11
11
  t.datetime :expired_at
12
12
  t.datetime :deleted_at
13
- t.string :state
14
- t.boolean :expiration_notice_to_agent, :default => false
13
+ t.boolean :expiration_notice_to_patron, :default => false
15
14
  t.boolean :expiration_notice_to_library, :default => false
16
15
  end
17
16
 
@@ -1,5 +1,5 @@
1
1
  class CreateLibraries < ActiveRecord::Migration
2
- def change
2
+ def self.up
3
3
  create_table :libraries do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -25,4 +25,8 @@ class CreateLibraries < ActiveRecord::Migration
25
25
  add_index :libraries, :library_group_id
26
26
  add_index :libraries, :name, :unique => true
27
27
  end
28
+
29
+ def self.down
30
+ drop_table :libraries
31
+ end
28
32
  end
@@ -1,5 +1,5 @@
1
1
  class CreateShelves < ActiveRecord::Migration
2
- def change
2
+ def self.up
3
3
  create_table :shelves do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -12,4 +12,8 @@ class CreateShelves < ActiveRecord::Migration
12
12
  end
13
13
  add_index :shelves, :library_id
14
14
  end
15
+
16
+ def self.down
17
+ drop_table :shelves
18
+ end
15
19
  end
@@ -1,12 +1,16 @@
1
1
  class CreateUserGroups < ActiveRecord::Migration
2
- def change
2
+ def self.up
3
3
  create_table :user_groups do |t|
4
- t.string :name, :not_null => true
5
- t.text :display_name
4
+ t.string :name, :string, :not_null => true
5
+ t.text :display_name, :string
6
6
  t.text :note
7
7
  t.integer :position
8
8
  t.timestamps
9
9
  t.datetime :deleted_at
10
10
  end
11
11
  end
12
+
13
+ def self.down
14
+ drop_table :user_groups
15
+ end
12
16
  end
@@ -1,5 +1,5 @@
1
1
  class CreateLibraryGroups < ActiveRecord::Migration
2
- def change
2
+ def self.up
3
3
  create_table :library_groups do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -11,10 +11,15 @@ class CreateLibraryGroups < ActiveRecord::Migration
11
11
  t.text :login_banner
12
12
  t.text :note
13
13
  t.integer :valid_period_for_new_user, :default => 365, :null => false
14
+ t.boolean :post_to_union_catalog, :default => false, :null => false
14
15
  t.integer :country_id
15
16
 
16
17
  t.timestamps
17
18
  end
18
19
  add_index :library_groups, :short_name
19
20
  end
21
+
22
+ def self.down
23
+ drop_table :library_groups
24
+ end
20
25
  end
@@ -0,0 +1,23 @@
1
+ class CreateEvents < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :events do |t|
4
+ t.integer :library_id, :default => 1, :null => false
5
+ t.integer :event_category_id, :default => 1, :null => false
6
+ t.string :name
7
+ t.text :note
8
+ t.datetime :start_at
9
+ t.datetime :end_at
10
+ t.boolean :all_day, :default => false, :null => false
11
+ t.datetime :deleted_at
12
+ t.text :display_name
13
+
14
+ t.timestamps
15
+ end
16
+ add_index :events, :library_id
17
+ add_index :events, :event_category_id
18
+ end
19
+
20
+ def self.down
21
+ drop_table :events
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ class CreateEventCategories < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :event_categories 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 :event_categories
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  class CreateRequestStatusTypes < ActiveRecord::Migration
2
- def change
2
+ def self.up
3
3
  create_table :request_status_types do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -9,4 +9,8 @@ class CreateRequestStatusTypes < ActiveRecord::Migration
9
9
  t.timestamps
10
10
  end
11
11
  end
12
+
13
+ def self.down
14
+ drop_table :request_status_types
15
+ end
12
16
  end
@@ -1,5 +1,5 @@
1
1
  class CreateRequestTypes < ActiveRecord::Migration
2
- def change
2
+ def self.up
3
3
  create_table :request_types do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -9,4 +9,8 @@ class CreateRequestTypes < ActiveRecord::Migration
9
9
  t.timestamps
10
10
  end
11
11
  end
12
+
13
+ def self.down
14
+ drop_table :request_types
15
+ end
12
16
  end
@@ -0,0 +1,15 @@
1
+ class CreateAgentMerges < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :agent_merges do |t|
4
+ t.integer :agent_id, :agent_merge_list_id, :null => false
5
+
6
+ t.timestamps
7
+ end
8
+ add_index :agent_merges, :agent_id
9
+ add_index :agent_merges, :agent_merge_list_id
10
+ end
11
+
12
+ def self.down
13
+ drop_table :agent_merges
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ class CreateAgentMergeLists < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :agent_merge_lists do |t|
4
+ t.string :title
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :agent_merge_lists
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ class CreateClassifications < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :classifications do |t|
4
+ t.integer :parent_id
5
+ t.string :category, :null => false
6
+ t.text :note
7
+ t.integer :classification_type_id, :null => false
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :classifications, :parent_id
12
+ add_index :classifications, :category
13
+ add_index :classifications, :classification_type_id
14
+ end
15
+
16
+ def self.down
17
+ drop_table :classifications
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ class CreateClassificationTypes < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :classification_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 :classification_types
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ class CreateSubjectHeadingTypes < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :subject_heading_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 :subject_heading_types
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ class CreateSubjectTypes < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :subject_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 :subject_types
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ class CreateMessageTemplates < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :message_templates do |t|
4
+ t.string :status, :null => false
5
+ t.text :title, :null => false
6
+ t.text :body, :null => false
7
+ t.integer :position
8
+ t.string :locale, :default => I18n.default_locale.to_s
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :message_templates, :status, :unique => true
13
+ end
14
+
15
+ def self.down
16
+ drop_table :message_templates
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ class CreateMessages < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :messages, :force => true do |t|
4
+ t.datetime :read_at
5
+ t.integer :receiver_id, :sender_id
6
+ t.string :subject, :null => false
7
+ t.text :body
8
+ t.integer :message_request_id
9
+ t.integer :parent_id
10
+
11
+ t.timestamps
12
+ end
13
+
14
+ add_index :messages, :sender_id
15
+ add_index :messages, :receiver_id
16
+ add_index :messages, :message_request_id
17
+ add_index :messages, :parent_id
18
+ end
19
+
20
+ def self.down
21
+ drop_table :messages
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ class CreateMessageRequests < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :message_requests do |t|
4
+ t.integer :sender_id
5
+ t.integer :receiver_id
6
+ t.integer :message_template_id
7
+ t.datetime :sent_at
8
+ t.datetime :deleted_at
9
+ t.text :body
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def self.down
16
+ drop_table :message_requests
17
+ end
18
+ end
@@ -4,7 +4,6 @@ class CreateManifestationCheckoutStats < ActiveRecord::Migration
4
4
  t.datetime :start_date
5
5
  t.datetime :end_date
6
6
  t.text :note
7
- t.string :state
8
7
 
9
8
  t.timestamps
10
9
  end
@@ -4,7 +4,6 @@ class CreateUserCheckoutStats < ActiveRecord::Migration
4
4
  t.datetime :start_date
5
5
  t.datetime :end_date
6
6
  t.text :note
7
- t.string :state
8
7
 
9
8
  t.timestamps
10
9
  end
@@ -4,7 +4,6 @@ class CreateManifestationReserveStats < ActiveRecord::Migration
4
4
  t.datetime :start_date
5
5
  t.datetime :end_date
6
6
  t.text :note
7
- t.string :state
8
7
 
9
8
  t.timestamps
10
9
  end
@@ -4,7 +4,6 @@ class CreateUserReserveStats < ActiveRecord::Migration
4
4
  t.datetime :start_date
5
5
  t.datetime :end_date
6
6
  t.text :note
7
- t.string :state
8
7
 
9
8
  t.timestamps
10
9
  end