bullet 7.0.6 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/README.md +3 -0
- data/lib/bullet/active_record4.rb +9 -0
- data/lib/bullet/active_record41.rb +9 -0
- data/lib/bullet/active_record42.rb +9 -0
- data/lib/bullet/active_record5.rb +11 -0
- data/lib/bullet/active_record52.rb +11 -0
- data/lib/bullet/active_record60.rb +11 -0
- data/lib/bullet/active_record61.rb +11 -0
- data/lib/bullet/active_record70.rb +19 -6
- data/lib/bullet/active_record71.rb +297 -0
- data/lib/bullet/dependency.rb +12 -0
- data/lib/bullet/detector/unused_eager_loading.rb +1 -1
- data/lib/bullet/mongoid8x.rb +59 -0
- data/lib/bullet/notification/counter_cache.rb +1 -1
- data/lib/bullet/rack.rb +1 -1
- data/lib/bullet/version.rb +1 -1
- data/lib/bullet.rb +6 -2
- metadata +7 -155
- data/.github/workflows/main.yml +0 -82
- data/.gitignore +0 -15
- data/.rspec +0 -2
- data/Gemfile +0 -24
- data/Gemfile.mongoid +0 -12
- data/Gemfile.mongoid-4.0 +0 -15
- data/Gemfile.mongoid-5.0 +0 -15
- data/Gemfile.mongoid-6.0 +0 -15
- data/Gemfile.mongoid-7.0 +0 -15
- data/Gemfile.rails-4.0 +0 -16
- data/Gemfile.rails-4.1 +0 -16
- data/Gemfile.rails-4.2 +0 -16
- data/Gemfile.rails-5.0 +0 -15
- data/Gemfile.rails-5.1 +0 -15
- data/Gemfile.rails-5.2 +0 -15
- data/Gemfile.rails-6.0 +0 -15
- data/Gemfile.rails-6.1 +0 -15
- data/Gemfile.rails-7.0 +0 -10
- data/Guardfile +0 -8
- data/Hacking.md +0 -75
- data/Rakefile +0 -51
- data/bullet.gemspec +0 -33
- data/perf/benchmark.rb +0 -118
- data/rails/init.rb +0 -3
- data/spec/bullet/detector/association_spec.rb +0 -28
- data/spec/bullet/detector/base_spec.rb +0 -10
- data/spec/bullet/detector/counter_cache_spec.rb +0 -58
- data/spec/bullet/detector/n_plus_one_query_spec.rb +0 -150
- data/spec/bullet/detector/unused_eager_loading_spec.rb +0 -126
- data/spec/bullet/ext/object_spec.rb +0 -44
- data/spec/bullet/ext/string_spec.rb +0 -15
- data/spec/bullet/notification/base_spec.rb +0 -94
- data/spec/bullet/notification/counter_cache_spec.rb +0 -14
- data/spec/bullet/notification/n_plus_one_query_spec.rb +0 -29
- data/spec/bullet/notification/unused_eager_loading_spec.rb +0 -18
- data/spec/bullet/notification_collector_spec.rb +0 -34
- data/spec/bullet/rack_spec.rb +0 -296
- data/spec/bullet/registry/association_spec.rb +0 -28
- data/spec/bullet/registry/base_spec.rb +0 -46
- data/spec/bullet/registry/object_spec.rb +0 -26
- data/spec/bullet/stack_trace_filter_spec.rb +0 -26
- data/spec/bullet_spec.rb +0 -136
- data/spec/integration/active_record/association_spec.rb +0 -822
- data/spec/integration/counter_cache_spec.rb +0 -68
- data/spec/integration/mongoid/association_spec.rb +0 -246
- data/spec/models/address.rb +0 -5
- data/spec/models/attachment.rb +0 -5
- data/spec/models/author.rb +0 -5
- data/spec/models/base_user.rb +0 -7
- data/spec/models/category.rb +0 -12
- data/spec/models/city.rb +0 -5
- data/spec/models/client.rb +0 -8
- data/spec/models/comment.rb +0 -8
- data/spec/models/company.rb +0 -5
- data/spec/models/country.rb +0 -5
- data/spec/models/deal.rb +0 -5
- data/spec/models/document.rb +0 -7
- data/spec/models/entry.rb +0 -5
- data/spec/models/firm.rb +0 -7
- data/spec/models/folder.rb +0 -4
- data/spec/models/group.rb +0 -4
- data/spec/models/mongoid/address.rb +0 -9
- data/spec/models/mongoid/category.rb +0 -10
- data/spec/models/mongoid/comment.rb +0 -9
- data/spec/models/mongoid/company.rb +0 -9
- data/spec/models/mongoid/entry.rb +0 -9
- data/spec/models/mongoid/post.rb +0 -14
- data/spec/models/mongoid/user.rb +0 -7
- data/spec/models/newspaper.rb +0 -5
- data/spec/models/page.rb +0 -4
- data/spec/models/person.rb +0 -5
- data/spec/models/pet.rb +0 -5
- data/spec/models/post.rb +0 -34
- data/spec/models/relationship.rb +0 -6
- data/spec/models/reply.rb +0 -5
- data/spec/models/role.rb +0 -7
- data/spec/models/student.rb +0 -5
- data/spec/models/submission.rb +0 -7
- data/spec/models/teacher.rb +0 -5
- data/spec/models/user.rb +0 -8
- data/spec/models/writer.rb +0 -4
- data/spec/spec_helper.rb +0 -97
- data/spec/support/bullet_ext.rb +0 -56
- data/spec/support/mongo_seed.rb +0 -59
- data/spec/support/rack_double.rb +0 -49
- data/spec/support/sqlite_seed.rb +0 -284
- data/test.sh +0 -15
- data/update.sh +0 -10
data/spec/spec_helper.rb
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rspec'
|
4
|
-
begin
|
5
|
-
require 'active_record'
|
6
|
-
rescue LoadError
|
7
|
-
end
|
8
|
-
begin
|
9
|
-
require 'mongoid'
|
10
|
-
rescue LoadError
|
11
|
-
end
|
12
|
-
|
13
|
-
module Rails
|
14
|
-
class << self
|
15
|
-
def root
|
16
|
-
File.expand_path(__FILE__).split('/')[0..-3].join('/')
|
17
|
-
end
|
18
|
-
|
19
|
-
def env
|
20
|
-
'test'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
|
26
|
-
require 'bullet'
|
27
|
-
extend Bullet::Dependency
|
28
|
-
Bullet.enable = true
|
29
|
-
|
30
|
-
MODELS = File.join(File.dirname(__FILE__), 'models')
|
31
|
-
$LOAD_PATH.unshift(MODELS)
|
32
|
-
SUPPORT = File.join(File.dirname(__FILE__), 'support')
|
33
|
-
Dir[File.join(SUPPORT, '*.rb')].reject { |filename| filename =~ /_seed.rb$/ }.sort.each { |file| require file }
|
34
|
-
|
35
|
-
RSpec.configure do |config|
|
36
|
-
config.extend Bullet::Dependency
|
37
|
-
|
38
|
-
config.filter_run focus: true
|
39
|
-
config.run_all_when_everything_filtered = true
|
40
|
-
end
|
41
|
-
|
42
|
-
if active_record?
|
43
|
-
ActiveRecord::Migration.verbose = false
|
44
|
-
|
45
|
-
# Autoload every active_record model for the test suite that sits in spec/models.
|
46
|
-
Dir[File.join(MODELS, '*.rb')].sort.each do |filename|
|
47
|
-
name = File.basename(filename, '.rb')
|
48
|
-
autoload name.camelize.to_sym, name
|
49
|
-
end
|
50
|
-
require File.join(SUPPORT, 'sqlite_seed.rb')
|
51
|
-
|
52
|
-
RSpec.configure do |config|
|
53
|
-
config.before(:suite) do
|
54
|
-
Support::SqliteSeed.setup_db
|
55
|
-
Support::SqliteSeed.seed_db
|
56
|
-
end
|
57
|
-
|
58
|
-
config.before(:example) do
|
59
|
-
Bullet.start_request
|
60
|
-
Bullet.enable = true
|
61
|
-
end
|
62
|
-
|
63
|
-
config.after(:example) { Bullet.end_request }
|
64
|
-
end
|
65
|
-
|
66
|
-
if ENV['BULLET_LOG']
|
67
|
-
require 'logger'
|
68
|
-
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
if mongoid?
|
73
|
-
# Autoload every mongoid model for the test suite that sits in spec/models.
|
74
|
-
Dir[File.join(MODELS, 'mongoid', '*.rb')].sort.each { |file| require file }
|
75
|
-
require File.join(SUPPORT, 'mongo_seed.rb')
|
76
|
-
|
77
|
-
RSpec.configure do |config|
|
78
|
-
config.before(:suite) do
|
79
|
-
Support::MongoSeed.setup_db
|
80
|
-
Support::MongoSeed.seed_db
|
81
|
-
end
|
82
|
-
|
83
|
-
config.after(:suite) do
|
84
|
-
Support::MongoSeed.setup_db
|
85
|
-
Support::MongoSeed.teardown_db
|
86
|
-
end
|
87
|
-
|
88
|
-
config.before(:each) { Bullet.start_request }
|
89
|
-
|
90
|
-
config.after(:each) { Bullet.end_request }
|
91
|
-
end
|
92
|
-
|
93
|
-
if ENV['BULLET_LOG']
|
94
|
-
Mongoid.logger = Logger.new(STDOUT)
|
95
|
-
Moped.logger = Logger.new(STDOUT)
|
96
|
-
end
|
97
|
-
end
|
data/spec/support/bullet_ext.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Bullet
|
4
|
-
def self.collected_notifications_of_class(notification_class)
|
5
|
-
Bullet.notification_collector.collection.select { |notification| notification.is_a? notification_class }
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.collected_counter_cache_notifications
|
9
|
-
collected_notifications_of_class Bullet::Notification::CounterCache
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.collected_n_plus_one_query_notifications
|
13
|
-
collected_notifications_of_class Bullet::Notification::NPlusOneQuery
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.collected_unused_eager_association_notifications
|
17
|
-
collected_notifications_of_class Bullet::Notification::UnusedEagerLoading
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
module Bullet
|
22
|
-
module Detector
|
23
|
-
class Association
|
24
|
-
class << self
|
25
|
-
# returns true if all associations are preloaded
|
26
|
-
def completely_preloading_associations?
|
27
|
-
Bullet.collected_n_plus_one_query_notifications.empty?
|
28
|
-
end
|
29
|
-
|
30
|
-
def has_unused_preload_associations?
|
31
|
-
Bullet.collected_unused_eager_association_notifications.present?
|
32
|
-
end
|
33
|
-
|
34
|
-
# returns true if a given object has a specific association
|
35
|
-
def creating_object_association_for?(object, association)
|
36
|
-
object_associations[object.bullet_key].present? &&
|
37
|
-
object_associations[object.bullet_key].include?(association)
|
38
|
-
end
|
39
|
-
|
40
|
-
# returns true if a given class includes the specific unpreloaded association
|
41
|
-
def detecting_unpreloaded_association_for?(klass, association)
|
42
|
-
Bullet.collected_n_plus_one_query_notifications.select do |notification|
|
43
|
-
notification.base_class == klass.to_s && notification.associations.include?(association)
|
44
|
-
end.present?
|
45
|
-
end
|
46
|
-
|
47
|
-
# returns true if the given class includes the specific unused preloaded association
|
48
|
-
def unused_preload_associations_for?(klass, association)
|
49
|
-
Bullet.collected_unused_eager_association_notifications.select do |notification|
|
50
|
-
notification.base_class == klass.to_s && notification.associations.include?(association)
|
51
|
-
end.present?
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
data/spec/support/mongo_seed.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Support
|
4
|
-
module MongoSeed
|
5
|
-
module_function
|
6
|
-
|
7
|
-
def seed_db
|
8
|
-
category1 = Mongoid::Category.create(name: 'first')
|
9
|
-
category2 = Mongoid::Category.create(name: 'second')
|
10
|
-
|
11
|
-
post1 = category1.posts.create(name: 'first')
|
12
|
-
post1a = category1.posts.create(name: 'like first')
|
13
|
-
post2 = category2.posts.create(name: 'second')
|
14
|
-
|
15
|
-
post1.users << Mongoid::User.create(name: 'first')
|
16
|
-
post1.users << Mongoid::User.create(name: 'another')
|
17
|
-
post2.users << Mongoid::User.create(name: 'second')
|
18
|
-
|
19
|
-
comment1 = post1.comments.create(name: 'first')
|
20
|
-
comment2 = post1.comments.create(name: 'first2')
|
21
|
-
comment3 = post1.comments.create(name: 'first3')
|
22
|
-
comment4 = post1.comments.create(name: 'second')
|
23
|
-
comment8 = post1a.comments.create(name: 'like first 1')
|
24
|
-
comment9 = post1a.comments.create(name: 'like first 2')
|
25
|
-
comment5 = post2.comments.create(name: 'third')
|
26
|
-
comment6 = post2.comments.create(name: 'fourth')
|
27
|
-
comment7 = post2.comments.create(name: 'fourth')
|
28
|
-
|
29
|
-
entry1 = category1.entries.create(name: 'first')
|
30
|
-
entry2 = category1.entries.create(name: 'second')
|
31
|
-
|
32
|
-
company1 = Mongoid::Company.create(name: 'first')
|
33
|
-
company2 = Mongoid::Company.create(name: 'second')
|
34
|
-
|
35
|
-
Mongoid::Address.create(name: 'first', company: company1)
|
36
|
-
Mongoid::Address.create(name: 'second', company: company2)
|
37
|
-
end
|
38
|
-
|
39
|
-
def setup_db
|
40
|
-
if Mongoid::VERSION =~ /\A4/
|
41
|
-
Mongoid.configure do |config|
|
42
|
-
config.load_configuration(sessions: { default: { database: 'bullet', hosts: %w[localhost:27017] } })
|
43
|
-
end
|
44
|
-
else
|
45
|
-
Mongoid.configure do |config|
|
46
|
-
config.load_configuration(clients: { default: { database: 'bullet', hosts: %w[localhost:27017] } })
|
47
|
-
end
|
48
|
-
|
49
|
-
# Increase the level from DEBUG in order to avoid excessive logging to the screen
|
50
|
-
Mongo::Logger.logger.level = Logger::WARN
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def teardown_db
|
55
|
-
Mongoid.purge!
|
56
|
-
Mongoid::IdentityMap.clear if Mongoid.const_defined?(:IdentityMap)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
data/spec/support/rack_double.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Support
|
4
|
-
class AppDouble
|
5
|
-
def call(_env)
|
6
|
-
env = @env
|
7
|
-
[status, headers, response]
|
8
|
-
end
|
9
|
-
|
10
|
-
attr_writer :status
|
11
|
-
|
12
|
-
attr_writer :headers
|
13
|
-
|
14
|
-
def headers
|
15
|
-
@headers ||= { 'Content-Type' => 'text/html' }
|
16
|
-
@headers
|
17
|
-
end
|
18
|
-
|
19
|
-
attr_writer :response
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def status
|
24
|
-
@status || 200
|
25
|
-
end
|
26
|
-
|
27
|
-
def response
|
28
|
-
@response || ResponseDouble.new
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
class ResponseDouble
|
33
|
-
def initialize(actual_body = nil)
|
34
|
-
@actual_body = actual_body
|
35
|
-
end
|
36
|
-
|
37
|
-
def body
|
38
|
-
@body ||= '<html><head></head><body></body></html>'
|
39
|
-
end
|
40
|
-
|
41
|
-
attr_writer :body
|
42
|
-
|
43
|
-
def each
|
44
|
-
yield body
|
45
|
-
end
|
46
|
-
|
47
|
-
def close; end
|
48
|
-
end
|
49
|
-
end
|
data/spec/support/sqlite_seed.rb
DELETED
@@ -1,284 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Support
|
4
|
-
module SqliteSeed
|
5
|
-
module_function
|
6
|
-
|
7
|
-
def seed_db
|
8
|
-
newspaper1 = Newspaper.create(name: 'First Newspaper')
|
9
|
-
newspaper2 = Newspaper.create(name: 'Second Newspaper')
|
10
|
-
|
11
|
-
writer1 = Writer.create(name: 'first', newspaper: newspaper1)
|
12
|
-
writer2 = Writer.create(name: 'second', newspaper: newspaper2)
|
13
|
-
user1 = BaseUser.create(name: 'third', newspaper: newspaper1)
|
14
|
-
user2 = BaseUser.create(name: 'fourth', newspaper: newspaper2)
|
15
|
-
|
16
|
-
category1 = Category.create(name: 'first')
|
17
|
-
category2 = Category.create(name: 'second')
|
18
|
-
|
19
|
-
post1 = category1.posts.create(name: 'first', writer: writer1)
|
20
|
-
post1a = category1.posts.create(name: 'like first', writer: writer2, active: false)
|
21
|
-
post2 = category2.posts.create(name: 'second', writer: writer2)
|
22
|
-
post3 = category2.posts.create(name: 'third', writer: writer2)
|
23
|
-
|
24
|
-
deal1 = Deal.new(name: 'Deal 1')
|
25
|
-
deal1.posts << post1
|
26
|
-
deal1.posts << post2
|
27
|
-
deal2 = Deal.new(name: 'Deal 2')
|
28
|
-
post1.deals << deal1
|
29
|
-
post1.deals << deal2
|
30
|
-
|
31
|
-
comment1 = post1.comments.create(name: 'first', author: writer1)
|
32
|
-
comment2 = post1.comments.create(name: 'first2', author: writer1)
|
33
|
-
comment3 = post1.comments.create(name: 'first3', author: writer1)
|
34
|
-
comment4 = post1.comments.create(name: 'second', author: writer2)
|
35
|
-
comment8 = post1a.comments.create(name: 'like first 1', author: writer1)
|
36
|
-
comment9 = post1a.comments.create(name: 'like first 2', author: writer2)
|
37
|
-
comment5 = post2.comments.create(name: 'third', author: user1)
|
38
|
-
comment6 = post2.comments.create(name: 'fourth', author: user2)
|
39
|
-
comment7 = post2.comments.create(name: 'fourth', author: writer1)
|
40
|
-
|
41
|
-
entry1 = category1.entries.create(name: 'first')
|
42
|
-
entry2 = category1.entries.create(name: 'second')
|
43
|
-
|
44
|
-
student1 = Student.create(name: 'first')
|
45
|
-
student2 = Student.create(name: 'second')
|
46
|
-
teacher1 = Teacher.create(name: 'first')
|
47
|
-
teacher2 = Teacher.create(name: 'second')
|
48
|
-
student1.teachers = [teacher1, teacher2]
|
49
|
-
student2.teachers = [teacher1, teacher2]
|
50
|
-
teacher1.students << student1
|
51
|
-
teacher2.students << student2
|
52
|
-
|
53
|
-
firm1 = Firm.create(name: 'first')
|
54
|
-
firm2 = Firm.create(name: 'second')
|
55
|
-
group1 = Group.create(name: 'first')
|
56
|
-
group2 = Group.create(name: 'second')
|
57
|
-
client1 = Client.create(name: 'first', group: group1)
|
58
|
-
client2 = Client.create(name: 'second', group: group2)
|
59
|
-
firm1.clients = [client1, client2]
|
60
|
-
firm2.clients = [client1, client2]
|
61
|
-
client1.firms << firm1
|
62
|
-
client2.firms << firm2
|
63
|
-
|
64
|
-
company1 = Company.create(name: 'first')
|
65
|
-
company2 = Company.create(name: 'second')
|
66
|
-
|
67
|
-
Address.create(name: 'first', company: company1)
|
68
|
-
Address.create(name: 'second', company: company2)
|
69
|
-
|
70
|
-
country1 = Country.create(name: 'first')
|
71
|
-
country2 = Country.create(name: 'second')
|
72
|
-
|
73
|
-
country1.cities.create(name: 'first')
|
74
|
-
country1.cities.create(name: 'second')
|
75
|
-
country2.cities.create(name: 'third')
|
76
|
-
country2.cities.create(name: 'fourth')
|
77
|
-
|
78
|
-
person1 = Person.create(name: 'first')
|
79
|
-
person2 = Person.create(name: 'second')
|
80
|
-
|
81
|
-
person1.pets.create(name: 'first')
|
82
|
-
person1.pets.create(name: 'second')
|
83
|
-
person2.pets.create(name: 'third')
|
84
|
-
person2.pets.create(name: 'fourth')
|
85
|
-
|
86
|
-
author1 = Author.create(name: 'author1')
|
87
|
-
author2 = Author.create(name: 'author2')
|
88
|
-
folder1 = Folder.create(name: 'folder1', author_id: author1.id)
|
89
|
-
folder2 = Folder.create(name: 'folder2', author_id: author2.id)
|
90
|
-
page1 = Page.create(name: 'page1', parent_id: folder1.id, author_id: author1.id)
|
91
|
-
page2 = Page.create(name: 'page2', parent_id: folder1.id, author_id: author1.id)
|
92
|
-
page3 = Page.create(name: 'page3', parent_id: folder2.id, author_id: author2.id)
|
93
|
-
page4 = Page.create(name: 'page4', parent_id: folder2.id, author_id: author2.id)
|
94
|
-
|
95
|
-
role1 = Role.create(name: 'Admin')
|
96
|
-
role2 = Role.create(name: 'User')
|
97
|
-
|
98
|
-
user1 = User.create(name: 'user1', category: category1)
|
99
|
-
user2 = User.create(name: 'user2', category: category1)
|
100
|
-
|
101
|
-
user1.roles << role1
|
102
|
-
user1.roles << role2
|
103
|
-
user2.roles << role2
|
104
|
-
|
105
|
-
submission1 = user1.create_submission(name: 'submission1')
|
106
|
-
submission2 = user2.create_submission(name: 'submission2')
|
107
|
-
|
108
|
-
submission1.replies.create(name: 'reply1')
|
109
|
-
submission1.replies.create(name: 'reply2')
|
110
|
-
submission2.replies.create(name: 'reply3')
|
111
|
-
submission2.replies.create(name: 'reply4')
|
112
|
-
|
113
|
-
submission1.create_attachment(file_name: 'submission1 file')
|
114
|
-
submission2.create_attachment(file_name: 'submission2 file')
|
115
|
-
end
|
116
|
-
|
117
|
-
def setup_db
|
118
|
-
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
|
119
|
-
|
120
|
-
ActiveRecord::Schema.define(version: 1) do
|
121
|
-
create_table :addresses do |t|
|
122
|
-
t.column :name, :string
|
123
|
-
t.column :company_id, :integer
|
124
|
-
end
|
125
|
-
|
126
|
-
create_table :authors do |t|
|
127
|
-
t.string :name
|
128
|
-
end
|
129
|
-
|
130
|
-
create_table :base_users do |t|
|
131
|
-
t.column :name, :string
|
132
|
-
t.column :type, :string
|
133
|
-
t.column :newspaper_id, :integer
|
134
|
-
end
|
135
|
-
|
136
|
-
create_table :categories do |t|
|
137
|
-
t.column :name, :string
|
138
|
-
end
|
139
|
-
|
140
|
-
create_table :cities do |t|
|
141
|
-
t.string :name
|
142
|
-
t.integer :country_id
|
143
|
-
end
|
144
|
-
|
145
|
-
create_table :clients do |t|
|
146
|
-
t.column :name, :string
|
147
|
-
t.column :group_id, :integer
|
148
|
-
end
|
149
|
-
|
150
|
-
create_table :comments do |t|
|
151
|
-
t.column :name, :string
|
152
|
-
t.column :post_id, :integer
|
153
|
-
t.column :author_id, :integer
|
154
|
-
end
|
155
|
-
|
156
|
-
create_table :companies do |t|
|
157
|
-
t.column :name, :string
|
158
|
-
end
|
159
|
-
|
160
|
-
create_table :contacts do |t|
|
161
|
-
t.column :name, :string
|
162
|
-
end
|
163
|
-
|
164
|
-
create_table :countries do |t|
|
165
|
-
t.string :name
|
166
|
-
end
|
167
|
-
|
168
|
-
create_table :deals do |t|
|
169
|
-
t.column :name, :string
|
170
|
-
t.column :hotel_id, :integer
|
171
|
-
end
|
172
|
-
|
173
|
-
create_table :deals_posts do |t|
|
174
|
-
t.column :deal_id, :integer
|
175
|
-
t.column :post_id, :integer
|
176
|
-
end
|
177
|
-
|
178
|
-
create_table :documents do |t|
|
179
|
-
t.string :name
|
180
|
-
t.string :type
|
181
|
-
t.integer :parent_id
|
182
|
-
t.integer :author_id
|
183
|
-
end
|
184
|
-
|
185
|
-
create_table :emails do |t|
|
186
|
-
t.column :name, :string
|
187
|
-
t.column :contact_id, :integer
|
188
|
-
end
|
189
|
-
|
190
|
-
create_table :entries do |t|
|
191
|
-
t.column :name, :string
|
192
|
-
t.column :category_id, :integer
|
193
|
-
end
|
194
|
-
|
195
|
-
create_table :firms do |t|
|
196
|
-
t.column :name, :string
|
197
|
-
end
|
198
|
-
|
199
|
-
create_table :groups do |t|
|
200
|
-
t.column :name, :string
|
201
|
-
end
|
202
|
-
|
203
|
-
create_table :hotels do |t|
|
204
|
-
t.column :name, :string
|
205
|
-
t.column :location_id, :integer
|
206
|
-
end
|
207
|
-
|
208
|
-
create_table :locations do |t|
|
209
|
-
t.column :name, :string
|
210
|
-
end
|
211
|
-
|
212
|
-
create_table :newspapers do |t|
|
213
|
-
t.column :name, :string
|
214
|
-
end
|
215
|
-
|
216
|
-
create_table :people do |t|
|
217
|
-
t.string :name
|
218
|
-
t.integer :pets_count
|
219
|
-
end
|
220
|
-
|
221
|
-
create_table :pets do |t|
|
222
|
-
t.string :name
|
223
|
-
t.integer :person_id
|
224
|
-
end
|
225
|
-
|
226
|
-
create_table :posts do |t|
|
227
|
-
t.column :name, :string
|
228
|
-
t.column :category_id, :integer
|
229
|
-
t.column :writer_id, :integer
|
230
|
-
t.column :active, :boolean, default: true
|
231
|
-
end
|
232
|
-
|
233
|
-
create_table :relationships do |t|
|
234
|
-
t.column :firm_id, :integer
|
235
|
-
t.column :client_id, :integer
|
236
|
-
end
|
237
|
-
|
238
|
-
create_table :students do |t|
|
239
|
-
t.column :name, :string
|
240
|
-
end
|
241
|
-
|
242
|
-
create_table :students_teachers, id: false do |t|
|
243
|
-
t.column :student_id, :integer
|
244
|
-
t.column :teacher_id, :integer
|
245
|
-
end
|
246
|
-
|
247
|
-
create_table :teachers do |t|
|
248
|
-
t.column :name, :string
|
249
|
-
end
|
250
|
-
|
251
|
-
create_table :replies do |t|
|
252
|
-
t.column :name, :string
|
253
|
-
t.column :submission_id, :integer
|
254
|
-
end
|
255
|
-
|
256
|
-
create_table :roles do |t|
|
257
|
-
t.column :name, :string
|
258
|
-
t.column :resource_id, :integer
|
259
|
-
t.column :resource_type, :string
|
260
|
-
end
|
261
|
-
|
262
|
-
create_table :roles_users do |t|
|
263
|
-
t.column :role_id, :integer
|
264
|
-
t.column :user_id, :integer
|
265
|
-
end
|
266
|
-
|
267
|
-
create_table :submissions do |t|
|
268
|
-
t.column :name, :string
|
269
|
-
t.column :user_id, :integer
|
270
|
-
end
|
271
|
-
|
272
|
-
create_table :users do |t|
|
273
|
-
t.column :name, :string
|
274
|
-
t.column :category_id, :integer
|
275
|
-
end
|
276
|
-
|
277
|
-
create_table :attachments do |t|
|
278
|
-
t.column :file_name, :string
|
279
|
-
t.column :submission_id, :integer
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
data/test.sh
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#bundle update rails && bundle exec rspec spec
|
2
|
-
#BUNDLE_GEMFILE=Gemfile.mongoid bundle update mongoid && BUNDLE_GEMFILE=Gemfile.mongoid bundle exec rspec spec
|
3
|
-
BUNDLE_GEMFILE=Gemfile.rails-7.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-7.0 bundle exec rspec spec
|
4
|
-
BUNDLE_GEMFILE=Gemfile.rails-6.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-6.1 bundle exec rspec spec
|
5
|
-
BUNDLE_GEMFILE=Gemfile.rails-6.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-6.0 bundle exec rspec spec
|
6
|
-
BUNDLE_GEMFILE=Gemfile.rails-5.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-5.2 bundle exec rspec spec
|
7
|
-
BUNDLE_GEMFILE=Gemfile.rails-5.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-5.1 bundle exec rspec spec
|
8
|
-
BUNDLE_GEMFILE=Gemfile.rails-5.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-5.0 bundle exec rspec spec
|
9
|
-
BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle exec rspec spec
|
10
|
-
BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle exec rspec spec
|
11
|
-
BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle && BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle exec rspec spec
|
12
|
-
BUNDLE_GEMFILE=Gemfile.mongoid-7.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-7.0 bundle exec rspec spec
|
13
|
-
BUNDLE_GEMFILE=Gemfile.mongoid-6.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-6.0 bundle exec rspec spec
|
14
|
-
BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle exec rspec spec
|
15
|
-
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle && BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle exec rspec spec
|
data/update.sh
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
BUNDLE_GEMFILE=Gemfile.rails-5.2 bundle update
|
2
|
-
BUNDLE_GEMFILE=Gemfile.rails-5.1 bundle update
|
3
|
-
BUNDLE_GEMFILE=Gemfile.rails-5.0 bundle update
|
4
|
-
BUNDLE_GEMFILE=Gemfile.rails-4.2 bundle update
|
5
|
-
BUNDLE_GEMFILE=Gemfile.rails-4.1 bundle update
|
6
|
-
BUNDLE_GEMFILE=Gemfile.rails-4.0 bundle update
|
7
|
-
BUNDLE_GEMFILE=Gemfile.mongoid-7.0 bundle update
|
8
|
-
BUNDLE_GEMFILE=Gemfile.mongoid-6.0 bundle update
|
9
|
-
BUNDLE_GEMFILE=Gemfile.mongoid-5.0 bundle update
|
10
|
-
BUNDLE_GEMFILE=Gemfile.mongoid-4.0 bundle update
|