enju_bookmark 0.1.2.pre20 → 0.1.2.pre21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +8 -1
  3. data/Rakefile +0 -12
  4. data/app/controllers/bookmark_stat_has_manifestations_controller.rb +7 -0
  5. data/app/controllers/bookmark_stats_controller.rb +7 -2
  6. data/app/controllers/bookmarks_controller.rb +8 -3
  7. data/app/controllers/tags_controller.rb +6 -1
  8. data/app/models/bookmark.rb +1 -2
  9. data/app/models/bookmark_stat.rb +5 -2
  10. data/app/models/bookmark_stat_has_manifestation.rb +0 -2
  11. data/app/models/bookmark_stat_transition.rb +1 -1
  12. data/app/models/tag.rb +0 -1
  13. data/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +5 -1
  14. data/lib/enju_bookmark/engine.rb +0 -1
  15. data/lib/enju_bookmark/expire_tag_cloud.rb +1 -1
  16. data/lib/enju_bookmark/user.rb +1 -1
  17. data/lib/enju_bookmark/version.rb +1 -1
  18. data/spec/controllers/bookmarks_controller_spec.rb +4 -4
  19. data/spec/dummy/bin/bundle +3 -0
  20. data/spec/dummy/bin/rails +4 -0
  21. data/spec/dummy/bin/rake +4 -0
  22. data/spec/dummy/bin/setup +29 -0
  23. data/spec/dummy/config/application.yml +12 -3
  24. data/spec/dummy/config/database.yml +23 -18
  25. data/spec/dummy/db/migrate/041_create_roles.rb +13 -0
  26. data/spec/dummy/db/migrate/059_create_libraries.rb +1 -5
  27. data/spec/dummy/db/migrate/069_create_shelves.rb +1 -5
  28. data/spec/dummy/db/migrate/077_create_user_groups.rb +3 -7
  29. data/spec/dummy/db/migrate/080_create_library_groups.rb +2 -10
  30. data/spec/dummy/db/migrate/130_create_request_status_types.rb +1 -5
  31. data/spec/dummy/db/migrate/131_create_request_types.rb +1 -5
  32. data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
  33. data/spec/dummy/db/migrate/{20111201163718_create_user_has_roles.rb → 20100606065209_create_user_has_roles.rb} +2 -0
  34. data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
  35. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +1 -1
  36. data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +5 -1
  37. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +5 -1
  38. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +5 -1
  39. data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +5 -1
  40. data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +5 -1
  41. data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +5 -1
  42. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -1
  43. data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +5 -1
  44. data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +5 -1
  45. data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +5 -1
  46. data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +5 -1
  47. data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +5 -1
  48. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -1
  49. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  50. data/spec/dummy/db/migrate/20141003181336_add_full_name_transcription_to_profile.rb +5 -0
  51. data/spec/dummy/db/migrate/20141003182825_add_date_of_birth_to_profile.rb +5 -0
  52. data/spec/dummy/db/migrate/20141014065831_add_shelf_id_to_checkout.rb +6 -0
  53. data/spec/dummy/db/schema.rb +28 -10
  54. data/spec/fixtures/content_types.yml +6 -6
  55. data/spec/fixtures/library_groups.yml +0 -2
  56. data/spec/fixtures/manifestations.yml +114 -114
  57. data/spec/fixtures/users.yml +1 -1
  58. data/spec/spec_helper.rb +2 -0
  59. metadata +59 -31
  60. data/spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb +0 -9
  61. data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +0 -11
  62. data/spec/dummy/db/migrate/20111201121844_create_roles.rb +0 -12
  63. data/spec/dummy/script/rails +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c706947c13a96014a1a05ed98e330f2ed6513d56
4
- data.tar.gz: 7b02c40716559fcbc2bcbc7f7f7e6bb2e90aa746
3
+ metadata.gz: e245045469bf6b6bb54d0542d61978f6a7a48732
4
+ data.tar.gz: bb75f0e0507d21dc4ce7f7893a72572bbdb0f543
5
5
  SHA512:
6
- metadata.gz: 9d28319813f59f50f47c9c995bc689fc1ac3747e586bf0f37d8e35adaa132ca679396e0e4270ca638ee7857b6a54b8a670e8f80df77f7a3746eaee3cb01265e1
7
- data.tar.gz: 1f82adc490a4a0822ca13f600d8d874506f5dbbbe03272f94dac016b06ce0e2cafcd6dcd4930a9bf7dc6e0de2d2246b57125c5500c81aedd626121468b28ba9c
6
+ metadata.gz: c7e658cf65d0b2dee7b376b25f6f3fd435659a1322f8f7b03e7fce6825e3b2d1cf81074bae98af9c81cbfff5328bfc2dab33c97b0f8d6807f138ab56c8f4bc02
7
+ data.tar.gz: c9ae05c6b1b276195386be0f053ff540be267366fabd42a88c36c770531342e496b666e05fb76a96f145d36e3184103d5ab4328476c005d4cc2b6e54f397b47d
data/README.rdoc CHANGED
@@ -1,3 +1,10 @@
1
- = EnjuBookmark {<img src="https://secure.travis-ci.org/nabeta/enju_bookmark.png?branch=master" alt="Build Status" />}[http://travis-ci.org/nabeta/enju_bookmark]
1
+ = EnjuBookmark
2
+ {<img src="https://secure.travis-ci.org/next-l/enju_bookmark.png?branch=1.1" alt="Build Status" />}[http://travis-ci.org/next-l/enju_bookmark]
3
+ {<img src="https://coveralls.io/repos/next-l/enju_bookmark/badge.png?branch=1.1" alt="Coverage Status" />}[https://coveralls.io/r/next-l/enju_bookmark?branch=1.1]
4
+ {<img src="https://hakiri.io/github/next-l/enju_bookmark/1.1.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_bookmark/1.1]
2
5
 
3
6
  This project rocks and uses MIT-LICENSE.
7
+
8
+ == 製作者・貢献者 (Authors and contributors)
9
+ * {TANABE, Kosuke}[https://github.com/nabeta] ({@nabeta}[https://twitter.com/nabeta])
10
+ * {Project Next-L}[http://www.next-l.jp] ({@ProjectNextL}[https://twitter.com/ProjectNextL])
data/Rakefile CHANGED
@@ -23,7 +23,6 @@ end
23
23
  APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
24
  load 'rails/tasks/engine.rake'
25
25
 
26
-
27
26
  Bundler::GemHelper.install_tasks
28
27
 
29
28
  require 'rspec/core'
@@ -33,15 +32,4 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
33
32
  spec.pattern = FileList['spec/**/*_spec.rb']
34
33
  end
35
34
 
36
- task :default => :spec
37
- require 'rake/testtask'
38
-
39
- Rake::TestTask.new(:test) do |t|
40
- t.libs << 'lib'
41
- t.libs << 'test'
42
- t.pattern = 'test/**/*_test.rb'
43
- t.verbose = false
44
- end
45
-
46
-
47
35
  task :default => :spec
@@ -78,4 +78,11 @@ class BookmarkStatHasManifestationsController < ApplicationController
78
78
  format.json { head :no_content }
79
79
  end
80
80
  end
81
+
82
+ private
83
+ def bookmark_stat_has_manifestation_params
84
+ params.require(:bookmark_stat_has_manifestation).permit(
85
+ :bookmark_stat_id, :manifestation_id
86
+ )
87
+ end
81
88
  end
@@ -48,7 +48,7 @@ class BookmarkStatsController < ApplicationController
48
48
  # POST /bookmark_stats
49
49
  # POST /bookmark_stats.json
50
50
  def create
51
- @bookmark_stat = BookmarkStat.new(params[:bookmark_stat])
51
+ @bookmark_stat = BookmarkStat.new(bookmark_stat_params)
52
52
 
53
53
  respond_to do |format|
54
54
  if @bookmark_stat.save
@@ -65,7 +65,7 @@ class BookmarkStatsController < ApplicationController
65
65
  # PUT /bookmark_stats/1.json
66
66
  def update
67
67
  respond_to do |format|
68
- if @bookmark_stat.update_attributes(params[:bookmark_stat])
68
+ if @bookmark_stat.update_attributes(bookmark_stat_params)
69
69
  format.html { redirect_to @bookmark_stat, notice: t('controller.successfully_updated', model: t('activerecord.models.bookmark_stat')) }
70
70
  format.json { head :no_content }
71
71
  else
@@ -85,4 +85,9 @@ class BookmarkStatsController < ApplicationController
85
85
  format.json { head :no_content }
86
86
  end
87
87
  end
88
+
89
+ private
90
+ def bookmark_stat_params
91
+ params.require(:bookmark_stat).permit(:start_date, :end_date, :note)
92
+ end
88
93
  end
@@ -56,7 +56,7 @@ class BookmarksController < ApplicationController
56
56
 
57
57
  # GET /bookmarks/new
58
58
  def new
59
- @bookmark = current_user.bookmarks.new(params[:bookmark])
59
+ @bookmark = current_user.bookmarks.new(bookmark_params)
60
60
  manifestation = @bookmark.get_manifestation
61
61
  if manifestation
62
62
  if manifestation.bookmarked?(current_user)
@@ -77,7 +77,7 @@ class BookmarksController < ApplicationController
77
77
  # POST /bookmarks
78
78
  # POST /bookmarks.json
79
79
  def create
80
- @bookmark = current_user.bookmarks.new(params[:bookmark])
80
+ @bookmark = current_user.bookmarks.new(bookmark_params)
81
81
 
82
82
  respond_to do |format|
83
83
  if @bookmark.save
@@ -109,7 +109,7 @@ class BookmarksController < ApplicationController
109
109
  @bookmark.taggings.where(:tagger_id => @bookmark.user.id).map{|t| t.destroy}
110
110
 
111
111
  respond_to do |format|
112
- if @bookmark.update_attributes(params[:bookmark])
112
+ if @bookmark.update_attributes(bookmark_params)
113
113
  @bookmark.tag_index!
114
114
  case params[:mode]
115
115
  when 'tag_edit'
@@ -143,4 +143,9 @@ class BookmarksController < ApplicationController
143
143
  end
144
144
  end
145
145
  end
146
+
147
+ private
148
+ def bookmark_params
149
+ params.require(:bookmark).permit(:title, :url, :note, :shared, :tag_list)
150
+ end
146
151
  end
@@ -48,7 +48,7 @@ class TagsController < ApplicationController
48
48
  #@tag = Tag.find(params[:id])
49
49
 
50
50
  respond_to do |format|
51
- if @tag.update_attributes(params[:tag])
51
+ if @tag.update_attributes(tag_params)
52
52
  format.html { redirect_to @tag, notice: t('controller.successfully_updated', model: t('activerecord.models.tag')) }
53
53
  format.json { head :no_content }
54
54
  else
@@ -69,4 +69,9 @@ class TagsController < ApplicationController
69
69
  format.json { head :no_content }
70
70
  end
71
71
  end
72
+
73
+ private
74
+ def tag_params
75
+ params.require(:tag).permit(:name, :name_transcription)
76
+ end
72
77
  end
@@ -1,9 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  class Bookmark < ActiveRecord::Base
3
- attr_accessible :title, :url, :note, :shared, :tag_list
4
3
  scope :bookmarked, lambda {|start_date, end_date| where('created_at >= ? AND created_at < ?', start_date, end_date)}
5
4
  scope :user_bookmarks, lambda {|user| where(user_id: user.id)}
6
- scope :shared, where(shared: true)
5
+ scope :shared, -> {where(shared: true)}
7
6
  belongs_to :manifestation, touch: true
8
7
  belongs_to :user #, counter_cache: true, validate: true
9
8
 
@@ -1,7 +1,6 @@
1
1
  class BookmarkStat < ActiveRecord::Base
2
- include Statesman::Adapters::ActiveRecordModel
2
+ include Statesman::Adapters::ActiveRecordQueries
3
3
  include CalculateStat
4
- attr_accessible :start_date, :end_date, :note
5
4
  default_scope { order('bookmark_stats.id DESC') }
6
5
  scope :not_calculated, -> {in_state(:pending)}
7
6
  has_many :bookmark_stat_has_manifestations
@@ -39,6 +38,10 @@ class BookmarkStat < ActiveRecord::Base
39
38
  def self.transition_class
40
39
  BookmarkStatTransition
41
40
  end
41
+
42
+ def self.initial_state
43
+ :pending
44
+ end
42
45
  end
43
46
 
44
47
  # == Schema Information
@@ -1,6 +1,4 @@
1
1
  class BookmarkStatHasManifestation < ActiveRecord::Base
2
- attr_accessible
3
- attr_accessible :bookmark_stat_id, :manifestation_id, as: :admin
4
2
  belongs_to :bookmark_stat
5
3
  belongs_to :manifestation
6
4
 
@@ -3,7 +3,7 @@ class BookmarkStatTransition < ActiveRecord::Base
3
3
 
4
4
 
5
5
  belongs_to :bookmark_stat, inverse_of: :bookmark_stat_transitions
6
- attr_accessible :to_state, :sort_key, :metadata
6
+ #attr_accessible :to_state, :sort_key, :metadata
7
7
  end
8
8
 
9
9
  # == Schema Information
data/app/models/tag.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  class Tag < ActiveRecord::Base
2
- attr_accessible :name, :name_transcription
3
2
  has_many :taggings, dependent: :destroy, class_name: 'ActsAsTaggableOn::Tagging'
4
3
  validates :name, presence: true
5
4
  after_save :save_taggings
@@ -2,7 +2,11 @@ class CreateBookmarkStatTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :bookmark_stat_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :bookmark_stat_id
8
12
  t.timestamps
@@ -1,4 +1,3 @@
1
- require 'enju_seed'
2
1
  require 'acts-as-taggable-on'
3
2
  require 'statesman'
4
3
  require 'addressable/uri'
@@ -2,7 +2,7 @@ module ExpireTagCloud
2
2
  def expire_tag_cloud(bookmark)
3
3
  I18n.available_locales.each do |locale|
4
4
  Role.all_cache.each do |role|
5
- expire_fragment(:controller => :tags, :action => :index, :page => 'user_tag_cloud', :user_id => bookmark.user.username, :locale => locale, :role => role.name, :user_id => nil)
5
+ expire_fragment(:controller => :tags, :action => :index, :page => 'user_tag_cloud', :user_id => bookmark.user.username, :locale => locale, :role => role.name)
6
6
  expire_fragment(:controller => :tags, :action => :index, :page => 'public_tag_cloud', :locale => locale, :role => role.name, :user_id => nil)
7
7
  end
8
8
  end
@@ -10,7 +10,7 @@ module EnjuBookmark
10
10
  has_many :bookmarks, :dependent => :destroy
11
11
  acts_as_tagger
12
12
 
13
- attr_accessible :share_bookmarks, as: :admin
13
+ #attr_accessible :share_bookmarks, as: :admin
14
14
  end
15
15
  end
16
16
 
@@ -1,3 +1,3 @@
1
1
  module EnjuBookmark
2
- VERSION = "0.1.2.pre20"
2
+ VERSION = "0.1.2.pre21"
3
3
  end
@@ -134,7 +134,7 @@ describe BookmarksController do
134
134
  login_fixture_admin
135
135
 
136
136
  it "assigns the requested bookmark as @bookmark" do
137
- get :new
137
+ get :new, bookmark: { title: 'test' }
138
138
  expect(assigns(:bookmark)).not_to be_valid
139
139
  expect(response).to be_success
140
140
  end
@@ -144,7 +144,7 @@ describe BookmarksController do
144
144
  login_fixture_librarian
145
145
 
146
146
  it "assigns the requested bookmark as @bookmark" do
147
- get :new
147
+ get :new, bookmark: { title: 'test' }
148
148
  expect(assigns(:bookmark)).not_to be_valid
149
149
  expect(response).to be_success
150
150
  end
@@ -154,7 +154,7 @@ describe BookmarksController do
154
154
  login_fixture_user
155
155
 
156
156
  it "should get my new template without url" do
157
- get :new
157
+ get :new, bookmark: { title: 'test' }
158
158
  expect(assigns(:bookmark)).not_to be_valid
159
159
  expect(response).to be_success
160
160
  end
@@ -395,7 +395,7 @@ describe BookmarksController do
395
395
  end
396
396
 
397
397
  it "should update bookmark" do
398
- put :update, :id => 3, :bookmark => { }
398
+ put :update, :id => 3, :bookmark => { title: 'test' }
399
399
  expect(response).to redirect_to bookmark_url(assigns(:bookmark))
400
400
  end
401
401
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -1,7 +1,8 @@
1
1
  defaults: &defaults
2
2
  enju:
3
- web_hostname: localhost
4
- web_port_number: 3000
3
+ erms_url:
4
+ skip_mobile_agents:
5
+ - ipad
5
6
 
6
7
  family_name_first: true
7
8
  max_number_of_results: 500
@@ -19,7 +20,7 @@ defaults: &defaults
19
20
  # :google, :amazon
20
21
  book_jacket:
21
22
  source: :google
22
- unknown_resource:
23
+ unknown_resource:
23
24
 
24
25
  # :mozshot, :simpleapi, :heartrails, :thumbalizr
25
26
  screenshot:
@@ -28,6 +29,14 @@ defaults: &defaults
28
29
  uploaded_file:
29
30
  storage: :local
30
31
 
32
+ manifestation:
33
+ facet:
34
+ pub_year_range_interval: 10
35
+
36
+ news_post:
37
+ number:
38
+ top_page: 3
39
+
31
40
  development:
32
41
  <<: *defaults
33
42
 
@@ -1,25 +1,30 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
1
+ sqlite: &sqlite
7
2
  adapter: sqlite3
8
- database: db/development.sqlite3
3
+ database: db/<%= Rails.env %>.sqlite3
4
+
5
+ mysql: &mysql
6
+ adapter: mysql2
7
+ username: root
8
+ password:
9
+ database: enju_<%= Rails.env %>
10
+
11
+ postgresql: &postgresql
12
+ adapter: postgresql
13
+ username: postgres
14
+ password:
15
+ database: enju_<%= Rails.env %>
16
+
17
+ defaults: &defaults
9
18
  pool: 5
10
19
  timeout: 5000
20
+ host: localhost
21
+ <<: *<%= ENV['DB'] || "sqlite" %>
22
+
23
+ development:
24
+ <<: *defaults
11
25
 
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
26
  test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
27
+ <<: *defaults
20
28
 
21
29
  production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
30
+ <<: *defaults
@@ -0,0 +1,13 @@
1
+ class CreateRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table "roles" do |t|
4
+ t.column :name, :string, :null => false
5
+ t.column :display_name, :string
6
+ t.column :note, :text
7
+ t.column :created_at, :datetime
8
+ t.column :updated_at, :datetime
9
+ t.integer :score, :default => 0, :null => false
10
+ t.integer :position
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  class CreateLibraries < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :libraries do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -25,8 +25,4 @@ 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
32
28
  end
@@ -1,5 +1,5 @@
1
1
  class CreateShelves < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :shelves do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -12,8 +12,4 @@ 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
19
15
  end
@@ -1,16 +1,12 @@
1
1
  class CreateUserGroups < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :user_groups do |t|
4
- t.string :name, :string, :not_null => true
5
- t.text :display_name, :string
4
+ t.string :name, :not_null => true
5
+ t.text :display_name
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
16
12
  end
@@ -1,25 +1,17 @@
1
1
  class CreateLibraryGroups < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :library_groups do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
6
6
  t.string :short_name, :null => false
7
- t.string :email
8
7
  t.text :my_networks
9
- t.boolean :use_dsbl, :default => false, :null => false
10
- t.text :dsbl_list
11
8
  t.text :login_banner
12
9
  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
10
  t.integer :country_id
11
+ t.integer :position
16
12
 
17
13
  t.timestamps
18
14
  end
19
15
  add_index :library_groups, :short_name
20
16
  end
21
-
22
- def self.down
23
- drop_table :library_groups
24
- end
25
17
  end
@@ -1,5 +1,5 @@
1
1
  class CreateRequestStatusTypes < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :request_status_types do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -9,8 +9,4 @@ 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
16
12
  end
@@ -1,5 +1,5 @@
1
1
  class CreateRequestTypes < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :request_types do |t|
4
4
  t.string :name, :null => false
5
5
  t.text :display_name
@@ -9,8 +9,4 @@ 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
16
12
  end
@@ -0,0 +1,9 @@
1
+ class AddOpeningHourToLibrary < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :libraries, :opening_hour, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :libraries, :opening_hour
8
+ end
9
+ end
@@ -6,5 +6,7 @@ class CreateUserHasRoles < ActiveRecord::Migration
6
6
 
7
7
  t.timestamps
8
8
  end
9
+ add_index :user_has_roles, :user_id
10
+ add_index :user_has_roles, :role_id
9
11
  end
10
12
  end
@@ -0,0 +1,6 @@
1
+ class AddLatitudeAndLongitudeToLibrary < ActiveRecord::Migration
2
+ def change
3
+ add_column :libraries, :latitude, :float
4
+ add_column :libraries, :longitude, :float
5
+ end
6
+ end
@@ -15,6 +15,6 @@ class CreateProfiles < ActiveRecord::Migration
15
15
  end
16
16
 
17
17
  add_index :profiles, :user_id
18
- add_index :profiles, :user_number
18
+ add_index :profiles, :user_number, :unique => true
19
19
  end
20
20
  end
@@ -2,7 +2,11 @@ class CreateReserveTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :reserve_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :reserve_id
8
12
  t.timestamps
@@ -2,7 +2,11 @@ class CreateMessageTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :message_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :message_id
8
12
  t.timestamps
@@ -2,7 +2,11 @@ class CreateMessageRequestTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :message_request_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :message_request_id
8
12
  t.timestamps
@@ -2,7 +2,11 @@ class CreateResourceImportFileTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :resource_import_file_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :resource_import_file_id
8
12
  t.timestamps
@@ -2,7 +2,11 @@ class CreateImportRequestTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :import_request_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :import_request_id
8
12
  t.timestamps