enju_subject 0.3.0.beta.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +10 -0
  3. data/Rakefile +1 -1
  4. data/app/controllers/classification_types_controller.rb +1 -1
  5. data/app/controllers/classifications_controller.rb +1 -2
  6. data/app/controllers/subject_heading_types_controller.rb +1 -1
  7. data/app/controllers/subject_types_controller.rb +1 -1
  8. data/app/controllers/subjects_controller.rb +2 -3
  9. data/app/models/classification.rb +1 -1
  10. data/app/models/classification_type.rb +1 -1
  11. data/app/models/subject.rb +1 -1
  12. data/app/models/subject_heading_type.rb +1 -1
  13. data/app/models/subject_type.rb +1 -1
  14. data/app/views/classification_types/_form.html.erb +1 -1
  15. data/app/views/manifestations/_subject_facet.html.erb +1 -1
  16. data/app/views/subject_heading_types/_form.html.erb +1 -1
  17. data/app/views/subject_types/_form.html.erb +1 -1
  18. data/lib/enju_subject/version.rb +1 -1
  19. data/lib/generators/enju_subject/setup/setup_generator.rb +0 -1
  20. data/spec/controllers/classification_types_controller_spec.rb +2 -2
  21. data/spec/controllers/classifications_controller_spec.rb +1 -1
  22. data/spec/controllers/subject_heading_types_controller_spec.rb +2 -2
  23. data/spec/controllers/subject_types_controller_spec.rb +2 -2
  24. data/spec/controllers/subjects_controller_spec.rb +1 -1
  25. data/spec/dummy/app/models/application_record.rb +3 -0
  26. data/spec/dummy/config/application.rb +1 -1
  27. data/spec/dummy/config/database.yml +17 -22
  28. data/spec/dummy/db/migrate/059_create_libraries.rb +3 -5
  29. data/spec/dummy/db/migrate/069_create_shelves.rb +1 -2
  30. data/spec/dummy/db/migrate/080_create_library_groups.rb +1 -2
  31. data/spec/dummy/db/migrate/120_create_baskets.rb +1 -2
  32. data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +2 -5
  33. data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +1 -2
  34. data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +0 -2
  35. data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
  36. data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
  37. data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +3 -6
  38. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
  39. data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +2 -2
  40. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
  41. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +1 -2
  42. data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +1 -1
  43. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +1 -1
  44. data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +1 -1
  45. data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +1 -1
  46. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +1 -3
  47. data/spec/dummy/db/migrate/20150117111136_add_foreign_key_to_items_referencing_manifestations.rb +5 -0
  48. data/spec/dummy/db/migrate/20150421023923_create_identities.rb +14 -0
  49. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +3 -5
  50. data/spec/dummy/db/migrate/20151125004028_add_profile_id_to_agent.rb +6 -0
  51. data/spec/dummy/db/migrate/20151126005552_add_provider_to_identity.rb +5 -0
  52. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +11 -6
  53. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +15 -2
  54. data/spec/dummy/db/migrate/20160801080612_add_most_recent_to_import_request_transitions.rb +9 -0
  55. data/spec/dummy/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb +9 -0
  56. data/spec/dummy/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb +9 -0
  57. data/spec/dummy/db/migrate/20160801080643_add_most_recent_to_agent_import_file_transitions.rb +9 -0
  58. data/spec/dummy/db/migrate/20160811102604_add_picture_width_to_picture_file.rb +6 -0
  59. data/spec/dummy/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb +11 -0
  60. data/spec/dummy/db/migrate/20170305064014_add_csv_charset_conversion_to_library_group.rb +5 -0
  61. data/spec/dummy/db/migrate/20171014084528_add_header_logo_to_library_group.rb +5 -0
  62. data/spec/dummy/db/migrate/20171119051258_set_not_null_to_manifestation_id_on_items.rb +5 -0
  63. data/spec/dummy/db/migrate/20171126133835_rename_login_banner_to_old_login_banner.rb +5 -0
  64. data/spec/dummy/db/migrate/20171126135238_add_foreign_key_to_library_group_id_on_library.rb +5 -0
  65. data/spec/dummy/db/migrate/20180102162311_add_header_logo_meta_to_library_group.rb +5 -0
  66. data/spec/dummy/db/migrate/20180107160726_add_constraints_to_most_recent_for_user_import_file_transitions.rb +13 -0
  67. data/spec/dummy/db/migrate/20180107160740_add_constraints_to_most_recent_for_user_export_file_transitions.rb +13 -0
  68. data/spec/dummy/db/migrate/20180107161311_add_constraints_to_most_recent_for_agent_import_file_transitions.rb +13 -0
  69. data/spec/dummy/db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb +13 -0
  70. data/spec/dummy/db/migrate/20180107161347_add_constraints_to_most_recent_for_resource_export_file_transitions.rb +13 -0
  71. data/spec/dummy/db/migrate/20180107161410_add_constraints_to_most_recent_for_import_request_transitions.rb +13 -0
  72. data/spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb +5 -0
  73. data/spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb +5 -0
  74. data/spec/dummy/db/migrate/20191219122214_create_custom_properties.rb +12 -0
  75. data/spec/dummy/db/migrate/20200425072340_create_manifestation_custom_properties.rb +12 -0
  76. data/spec/dummy/db/migrate/20200425072349_create_item_custom_properties.rb +12 -0
  77. data/spec/dummy/db/migrate/20200425074758_create_manifestation_custom_values.rb +12 -0
  78. data/spec/dummy/db/migrate/20200425074822_create_item_custom_values.rb +12 -0
  79. data/spec/dummy/db/schema.rb +110 -13
  80. data/spec/factories/profile.rb +2 -2
  81. data/spec/factories/user.rb +13 -13
  82. data/spec/fixtures/library_groups.yml +37 -19
  83. data/spec/lib/generators/enju_subject/setup/setup_generator_spec.rb +1 -0
  84. metadata +120 -19
  85. data/README.rdoc +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ba36d55ce3a4f2bd2b400058798a26f8e45757f2
4
- data.tar.gz: 8a518d848290f831f218d51082c2078aeecf24b5
2
+ SHA256:
3
+ metadata.gz: 13a77e302ed1fea49a89324f48453fc11b65714371e5d2241333a6096948f570
4
+ data.tar.gz: 9cd009abe585d7662c0f826aaf7618acc4b8033afa6e8974e0d60a81e6405e4e
5
5
  SHA512:
6
- metadata.gz: 1d6af4ad42830f2ffe06f0ada8923c3635f0e7b14e76f5426da66aff168d1f445000d46c7fcd8b3311049af11781ec02aa9a91726c8cfd5c44b3ee68446efe65
7
- data.tar.gz: d5146012d0c40b99ffebf22e49dfed9f7c4cd968081c84484eb7854b332277799b443332f794da54027c2e6a2a3136576141bb165a4f562e85a30a75d0d66cd6
6
+ metadata.gz: ec447e0ba0fc1b0e270f02e462adb264c5653d2083343e803ed676162ca57cb4b25826659bb6edc52c4c7f25f3cfcc40a44e8c69b7f3d9354e1510c7c2e9bef5
7
+ data.tar.gz: 5a0b71003ae24e8b308c29b337b03869a6e7392703399c0a57d225190724aaf41c8d72087654c7b0945f71c15a1aa4ab2fad03c4ecb76a983dbde24acb23afe8
@@ -0,0 +1,10 @@
1
+ # EnjuSubject
2
+ [![Travis CI](https://travis-ci.com/next-l/enju_subject.svg?branch=1.3)](https://travis-ci.com/next-l/enju_subject)
3
+ [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_subject/badge.svg?branch=1.3)](https://coveralls.io/github/next-l/enju_subject?branch=1.3)
4
+ [![security](https://hakiri.io/github/next-l/enju_subject/1.3.svg)](https://hakiri.io/github/next-l/enju_subject/1.3)
5
+
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](https://www.next-l.jp) ([@ProjectNextL](https://twitter.com/ProjectNextL))
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
16
16
  rdoc.rdoc_dir = 'rdoc'
17
17
  rdoc.title = 'EnjuSubject'
18
18
  rdoc.options << '--line-numbers'
19
- rdoc.rdoc_files.include('README.rdoc')
19
+ rdoc.rdoc_files.include('README.md')
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
@@ -62,7 +62,7 @@ class ClassificationTypesController < ApplicationController
62
62
  end
63
63
 
64
64
  respond_to do |format|
65
- if @classification_type.update_attributes(classification_type_params)
65
+ if @classification_type.update(classification_type_params)
66
66
  format.html { redirect_to @classification_type, notice: t('controller.successfully_updated', model: t('activerecord.models.classification_type')) }
67
67
  format.json { head :no_content }
68
68
  else
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  class ClassificationsController < ApplicationController
3
2
  before_action :set_classification, only: [:show, :edit, :update, :destroy]
4
3
  before_action :check_policy, only: [:index, :new, :create]
@@ -85,7 +84,7 @@ class ClassificationsController < ApplicationController
85
84
  # PUT /classifications/1.json
86
85
  def update
87
86
  respond_to do |format|
88
- if @classification.update_attributes(classification_params)
87
+ if @classification.update(classification_params)
89
88
  format.html { redirect_to @classification, notice: t('controller.successfully_updated', model: t('activerecord.models.classification')) }
90
89
  format.json { head :no_content }
91
90
  else
@@ -62,7 +62,7 @@ class SubjectHeadingTypesController < ApplicationController
62
62
  end
63
63
 
64
64
  respond_to do |format|
65
- if @subject_heading_type.update_attributes(subject_heading_type_params)
65
+ if @subject_heading_type.update(subject_heading_type_params)
66
66
  format.html { redirect_to @subject_heading_type, notice: t('controller.successfully_updated', model: t('activerecord.models.subject_heading_type')) }
67
67
  format.json { head :no_content }
68
68
  else
@@ -62,7 +62,7 @@ class SubjectTypesController < ApplicationController
62
62
  end
63
63
 
64
64
  respond_to do |format|
65
- if @subject_type.update_attributes(subject_type_params)
65
+ if @subject_type.update(subject_type_params)
66
66
  format.html { redirect_to @subject_type, notice: t('controller.successfully_updated', model: t('activerecord.models.subject_type')) }
67
67
  format.json { head :no_content }
68
68
  else
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  class SubjectsController < ApplicationController
3
2
  before_action :set_subject, only: [:show, :edit, :update, :destroy]
4
3
  before_action :check_policy, only: [:index, :new, :create]
@@ -53,7 +52,7 @@ class SubjectsController < ApplicationController
53
52
  # GET /subjects/1.json
54
53
  def show
55
54
  if params[:term]
56
- subject = Subject.where(term: params[:term]).first
55
+ subject = Subject.find_by(term: params[:term])
57
56
  redirected_to subject
58
57
  return
59
58
  end
@@ -107,7 +106,7 @@ class SubjectsController < ApplicationController
107
106
  # PUT /subjects/1.json
108
107
  def update
109
108
  respond_to do |format|
110
- if @subject.update_attributes(subject_params)
109
+ if @subject.update(subject_params)
111
110
  format.html { redirect_to @subject, notice: t('controller.successfully_updated', model: t('activerecord.models.subject')) }
112
111
  format.json { head :no_content }
113
112
  else
@@ -1,4 +1,4 @@
1
- class Classification < ActiveRecord::Base
1
+ class Classification < ApplicationRecord
2
2
  belongs_to :classification_type
3
3
  belongs_to :manifestation, touch: true, optional: true
4
4
 
@@ -1,4 +1,4 @@
1
- class ClassificationType < ActiveRecord::Base
1
+ class ClassificationType < ApplicationRecord
2
2
  include MasterModel
3
3
  has_many :classifications
4
4
  validates :name, format: { with: /\A[0-9a-z][0-9a-z_\-]*[0-9a-z]\Z/ }
@@ -1,4 +1,4 @@
1
- class Subject < ActiveRecord::Base
1
+ class Subject < ApplicationRecord
2
2
  belongs_to :manifestation, touch: true, optional: true
3
3
  belongs_to :subject_type
4
4
  belongs_to :subject_heading_type
@@ -1,4 +1,4 @@
1
- class SubjectHeadingType < ActiveRecord::Base
1
+ class SubjectHeadingType < ApplicationRecord
2
2
  include MasterModel
3
3
  has_many :subjects
4
4
  validates :name, format: {with: /\A[0-9a-z][0-9a-z_\-]*[0-9a-z]\Z/}
@@ -1,4 +1,4 @@
1
- class SubjectType < ActiveRecord::Base
1
+ class SubjectType < ApplicationRecord
2
2
  include MasterModel
3
3
  has_many :subjects
4
4
  validates :name, format: {with: /\A[0-9A-Za-z][0-9a-z_\-]*[0-9a-z]\Z/}
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="field">
5
5
  <%= f.label :name %><br />
6
- <%= f.text_field :name, class: 'short_name' %>
6
+ <%= f.text_field :name, required: true, class: 'short_name' %>
7
7
  </div>
8
8
  <div class="field">
9
9
  <%= f.label :display_name %><br />
@@ -2,7 +2,7 @@
2
2
  <%- unless @subject_facet.blank? -%>
3
3
  <ul>
4
4
  <%- @subject_facet[0..19].each do |facet| -%>
5
- <%- subject = Subject.where(id: facet.value).first -%>
5
+ <%- subject = Subject.find_by(id: facet.value) -%>
6
6
  <%- if subject -%>
7
7
  <li>
8
8
  <%= link_to "#{subject.term} (#{facet.count})", url_for(params.permit.merge(page: nil, subject: "\"#{subject.term}\"", view: nil, only_path: true)) -%>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="field">
5
5
  <%= f.label :name %><br />
6
- <%= f.text_field :name %>
6
+ <%= f.text_field :name, required: true %>
7
7
  </div>
8
8
  <div class="field">
9
9
  <%= f.label :display_name %><br />
@@ -3,7 +3,7 @@
3
3
 
4
4
  <div class="field">
5
5
  <%= f.label :name %><br />
6
- <%= f.text_field :name %>
6
+ <%= f.text_field :name, required: true %>
7
7
  </div>
8
8
  <div class="field">
9
9
  <%= f.label :display_name %><br />
@@ -1,3 +1,3 @@
1
1
  module EnjuSubject
2
- VERSION = "0.3.0.beta.1"
2
+ VERSION = "0.3.3".freeze
3
3
  end
@@ -3,7 +3,6 @@ class EnjuSubject::SetupGenerator < Rails::Generators::Base
3
3
 
4
4
  def copy_setup_files
5
5
  directory("db/fixtures", "db/fixtures/enju_subject")
6
- rake("enju_subject_engine:install:migrations")
7
6
  inject_into_file 'app/controllers/application_controller.rb',
8
7
  " include EnjuSubject::Controller\n", after: "EnjuLibrary::Controller\n"
9
8
  append_to_file("app/models/user.rb") do
@@ -96,7 +96,7 @@ describe ClassificationTypesController do
96
96
  it 'assigns the requested classification_type as @classification_type' do
97
97
  get :new
98
98
  expect(assigns(:classification_type)).not_to be_valid
99
- expect(response).to be_success
99
+ expect(response).to be_successful
100
100
  end
101
101
  end
102
102
 
@@ -198,7 +198,7 @@ describe ClassificationTypesController do
198
198
 
199
199
  it 'should be successful' do
200
200
  post :create, params: { classification_type: @invalid_attrs }
201
- expect(response).to be_success
201
+ expect(response).to be_successful
202
202
  end
203
203
  end
204
204
  end
@@ -47,7 +47,7 @@ describe ClassificationsController do
47
47
 
48
48
  it 'should get index with query' do
49
49
  get :index, params: { query: '500' }
50
- response.should be_success
50
+ response.should be_successful
51
51
  expect(assigns(:classifications)).not_to be_empty
52
52
  end
53
53
  end
@@ -96,7 +96,7 @@ describe SubjectHeadingTypesController do
96
96
  it 'assigns the requested subject_heading_type as @subject_heading_type' do
97
97
  get :new
98
98
  expect(assigns(:subject_heading_type)).not_to be_valid
99
- response.should be_success
99
+ response.should be_successful
100
100
  end
101
101
  end
102
102
 
@@ -198,7 +198,7 @@ describe SubjectHeadingTypesController do
198
198
 
199
199
  it 'should be successful' do
200
200
  post :create, params: { subject_heading_type: @invalid_attrs }
201
- response.should be_success
201
+ response.should be_successful
202
202
  end
203
203
  end
204
204
  end
@@ -98,7 +98,7 @@ describe SubjectTypesController do
98
98
  it 'assigns the requested subject_type as @subject_type' do
99
99
  get :new
100
100
  expect(assigns(:subject_type)).not_to be_valid
101
- response.should be_success
101
+ response.should be_successful
102
102
  end
103
103
  end
104
104
 
@@ -200,7 +200,7 @@ describe SubjectTypesController do
200
200
 
201
201
  it 'should be successful' do
202
202
  post :create, params: { subject_type: @invalid_attrs }
203
- response.should be_success
203
+ response.should be_successful
204
204
  end
205
205
  end
206
206
  end
@@ -42,7 +42,7 @@ describe SubjectsController do
42
42
  describe 'When not logged in' do
43
43
  it 'assigns all subjects as @subjects' do
44
44
  get :index
45
- response.should be_success
45
+ response.should be_successful
46
46
  expect(assigns(:subjects)).not_to be_nil
47
47
  end
48
48
  end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -9,7 +9,7 @@ require "enju_leaf"
9
9
  module Dummy
10
10
  class Application < Rails::Application
11
11
  # Initialize configuration defaults for originally generated Rails version.
12
- config.load_defaults 5.1
12
+ config.load_defaults 5.2
13
13
 
14
14
  # Settings in config/environments/* take precedence over those specified here.
15
15
  # Application configuration should go into files in config/initializers
@@ -1,30 +1,25 @@
1
- sqlite: &sqlite
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
+ #
7
+ default: &default
2
8
  adapter: 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
18
- pool: 5
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
19
10
  timeout: 5000
20
- host: localhost
21
- <<: *<%= ENV['DB'] || "sqlite" %>
22
11
 
23
12
  development:
24
- <<: *defaults
13
+ <<: *default
14
+ database: db/development.sqlite3
25
15
 
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
26
19
  test:
27
- <<: *defaults
20
+ <<: *default
21
+ database: db/test.sqlite3
28
22
 
29
23
  production:
30
- <<: *defaults
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -1,7 +1,7 @@
1
1
  class CreateLibraries < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :libraries do |t|
4
- t.string :name, null: false
4
+ t.string :name, index: true, null: false
5
5
  t.text :display_name
6
6
  t.string :short_display_name, null: false
7
7
  t.string :zip_code
@@ -14,15 +14,13 @@ class CreateLibraries < ActiveRecord::Migration[4.2]
14
14
  t.text :note
15
15
  t.integer :call_number_rows, default: 1, null: false
16
16
  t.string :call_number_delimiter, default: "|", null: false
17
- t.integer :library_group_id, default: 1, null: false
17
+ t.references :library_group, index: true, null: false
18
18
  t.integer :users_count, default: 0, null: false
19
19
  t.integer :position
20
- t.integer :country_id
20
+ t.references :country
21
21
 
22
22
  t.timestamps
23
23
  t.datetime :deleted_at
24
24
  end
25
- add_index :libraries, :library_group_id
26
- add_index :libraries, :name, unique: true
27
25
  end
28
26
  end
@@ -4,12 +4,11 @@ class CreateShelves < ActiveRecord::Migration[4.2]
4
4
  t.string :name, null: false
5
5
  t.text :display_name
6
6
  t.text :note
7
- t.integer :library_id, default: 1, null: false
7
+ t.references :library, index: true, null: false
8
8
  t.integer :items_count, default: 0, null: false
9
9
  t.integer :position
10
10
  t.timestamps
11
11
  t.datetime :deleted_at
12
12
  end
13
- add_index :shelves, :library_id
14
13
  end
15
14
  end
@@ -3,7 +3,7 @@ class CreateLibraryGroups < ActiveRecord::Migration[4.2]
3
3
  create_table :library_groups do |t|
4
4
  t.string :name, null: false
5
5
  t.text :display_name
6
- t.string :short_name, null: false
6
+ t.string :short_name, index: true, null: false
7
7
  t.text :my_networks
8
8
  t.text :login_banner
9
9
  t.text :note
@@ -12,6 +12,5 @@ class CreateLibraryGroups < ActiveRecord::Migration[4.2]
12
12
 
13
13
  t.timestamps
14
14
  end
15
- add_index :library_groups, :short_name
16
15
  end
17
16
  end
@@ -1,12 +1,11 @@
1
1
  class CreateBaskets < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :baskets do |t|
4
- t.integer :user_id
4
+ t.references :user, index: true
5
5
  t.text :note
6
6
  t.integer :lock_version, default: 0, null: false
7
7
 
8
8
  t.timestamps
9
9
  end
10
- add_index :baskets, :user_id
11
10
  end
12
11
  end
@@ -3,15 +3,12 @@ class CreateSubscriptions < ActiveRecord::Migration[4.2]
3
3
  create_table :subscriptions do |t|
4
4
  t.text :title, null: false
5
5
  t.text :note
6
- #t.integer :subscription_list_id, :integer
7
- t.integer :user_id
8
- t.integer :order_list_id
6
+ t.references :user, index: true
7
+ t.references :order_list, index: true
9
8
  t.datetime :deleted_at
10
9
  t.integer :subscribes_count, default: 0, null: false
11
10
 
12
11
  t.timestamps
13
12
  end
14
- add_index :subscriptions, :user_id
15
- add_index :subscriptions, :order_list_id
16
13
  end
17
14
  end
@@ -1,14 +1,13 @@
1
1
  class CreateSubscribes < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :subscribes do |t|
4
- t.integer :subscription_id, null: false
4
+ t.references :subscription, index: true, null: false
5
5
  t.integer :work_id, null: false
6
6
  t.datetime :start_at, null: false
7
7
  t.datetime :end_at, null: false
8
8
 
9
9
  t.timestamps
10
10
  end
11
- add_index :subscribes, :subscription_id
12
11
  add_index :subscribes, :work_id
13
12
  end
14
13
  end
@@ -3,9 +3,7 @@ class CreatePictureFiles < ActiveRecord::Migration[4.2]
3
3
  create_table :picture_files do |t|
4
4
  t.integer :picture_attachable_id
5
5
  t.string :picture_attachable_type
6
- t.string :content_type
7
6
  t.text :title
8
- t.string :thumbnail
9
7
  t.integer :position
10
8
 
11
9
  t.timestamps