scenic-mysql_adapter 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +2 -1
- data/.gitignore +1 -0
- data/Appraisals +29 -0
- data/README.md +1 -1
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/rails_42.gemfile +11 -0
- data/gemfiles/rails_50.gemfile +10 -0
- data/gemfiles/rails_51.gemfile +11 -0
- data/gemfiles/rails_52.gemfile +10 -0
- data/lib/scenic/adapters/railtie.rb +16 -0
- data/lib/scenic/mysql_adapter.rb +1 -0
- data/lib/scenic/mysql_adapter/schema_dumper.rb +42 -0
- data/lib/scenic/mysql_adapter/version.rb +1 -1
- data/scenic-mysql_adapter.gemspec +1 -0
- metadata +24 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6f0744e97155966fa7ce57be4b5a54af87f87df
|
4
|
+
data.tar.gz: c4e85b7b3f4ddd1515c0c18dc41137fc477ad4a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6ca4956ad189e565a7abeea03fa71092aa4010b9147cc3c9315e51d7d150d1b57897992b186ddcb331594d2a49c0d7e9778fe2fa6cac6d68b00e8a0d1634f3a
|
7
|
+
data.tar.gz: 18ee7349eeaa535d474a57d47eba3ed0e429ce177e858a75767d233d30f7e1a17de6c92db4805dd18a951b0eff55ea5aaa77a9553a75f8dcd07545e28f04bd19
|
data/.circleci/config.yml
CHANGED
data/.gitignore
CHANGED
data/Appraisals
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
appraise "rails-42" do
|
2
|
+
gem "mysql2", "0.4.4"
|
3
|
+
gem "activerecord", "~> 4.2", "< 5.0"
|
4
|
+
gem "activemodel", "~> 4.2", "< 5.0"
|
5
|
+
gem "actionpack", "~> 4.2", "< 5.0"
|
6
|
+
gem "activesupport", "~> 4.2", "< 5.0"
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise "rails-50" do
|
10
|
+
gem "activerecord", "~> 5.0", "< 5.1"
|
11
|
+
gem "activemodel", "~> 5.0", "< 5.1"
|
12
|
+
gem "actionpack", "~> 5.0", "< 5.1"
|
13
|
+
gem "activesupport", "~> 5.0", "< 5.1"
|
14
|
+
end
|
15
|
+
|
16
|
+
appraise "rails-51" do
|
17
|
+
gem "mysql2", "0.4.4"
|
18
|
+
gem "activerecord", "~> 5.1", "< 5.2"
|
19
|
+
gem "activemodel", "~> 5.1", "< 5.2"
|
20
|
+
gem "actionpack", "~> 5.1", "< 5.2"
|
21
|
+
gem "activesupport", "~> 5.1", "< 5.2"
|
22
|
+
end
|
23
|
+
|
24
|
+
appraise "rails-52" do
|
25
|
+
gem "activerecord", "~> 5.2"
|
26
|
+
gem "activemodel", "~> 5.2"
|
27
|
+
gem "actionpack", "~> 5.2"
|
28
|
+
gem "activesupport", "~> 5.2"
|
29
|
+
end
|
data/README.md
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "mysql2", "0.4.4"
|
6
|
+
gem "activerecord", "~> 4.2", "< 5.0"
|
7
|
+
gem "activemodel", "~> 4.2", "< 5.0"
|
8
|
+
gem "actionpack", "~> 4.2", "< 5.0"
|
9
|
+
gem "activesupport", "~> 4.2", "< 5.0"
|
10
|
+
|
11
|
+
gemspec path: "../"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "mysql2", "0.4.4"
|
6
|
+
gem "activerecord", "~> 5.1", "< 5.2"
|
7
|
+
gem "activemodel", "~> 5.1", "< 5.2"
|
8
|
+
gem "actionpack", "~> 5.1", "< 5.2"
|
9
|
+
gem "activesupport", "~> 5.1", "< 5.2"
|
10
|
+
|
11
|
+
gemspec path: "../"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "rails/railtie"
|
2
|
+
require 'active_record/connection_adapters/abstract_mysql_adapter'
|
3
|
+
require_relative '../mysql_adapter/schema_dumper'
|
4
|
+
|
5
|
+
module Scenic
|
6
|
+
module Adapters
|
7
|
+
class MySqlRailtie < Rails::Railtie
|
8
|
+
ActiveSupport.on_load :active_record do
|
9
|
+
unless ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.respond_to?(:views)
|
10
|
+
# Versions of Rails < 5 need this patch to avoid listing views as tables in schema.rb
|
11
|
+
ActiveRecord::SchemaDumper.prepend Scenic::Adapters::MySql::SchemaDumper
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/scenic/mysql_adapter.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
# This code is needed to support SQL views in MySQL in Rails < 5.1
|
2
|
+
# if you want to continue using 'db/schema.rb' instead of migrating to
|
3
|
+
# the SQL version 'db/structure.sql'.
|
4
|
+
#
|
5
|
+
# The problem is that, when you execute "SHOW TABLES" in MySQL, any
|
6
|
+
# view that you hava created also shows in that list.
|
7
|
+
#
|
8
|
+
# So when you create a view, when the 'db/schema.rb' file is updated,
|
9
|
+
# the view appears twice: first as a table, then as a view.
|
10
|
+
#
|
11
|
+
# As of this writing, the latest 5.x versions of Rails filter out
|
12
|
+
# views when providing the list of tables, so this problem doesn't
|
13
|
+
# appear. But for previous versions it's still there.
|
14
|
+
#
|
15
|
+
# This code patches the method SchemaDumper#table which is in charge
|
16
|
+
# of dumping a table to the 'db/schema.rb' file when it's being updated
|
17
|
+
# and does nothing when the supplied table is actually a view.
|
18
|
+
#
|
19
|
+
# This module needs to be prepended to ActiveRecord::SchemaDumper for
|
20
|
+
# the patch to work. See 'adapters/railtie.rb'
|
21
|
+
|
22
|
+
require "rails"
|
23
|
+
require_relative '../adapters/my_sql'
|
24
|
+
|
25
|
+
module Scenic
|
26
|
+
module Adapters
|
27
|
+
module MySql
|
28
|
+
module SchemaDumper
|
29
|
+
def table(table, stream)
|
30
|
+
return if defined_views.any? { |v| v.name == table } # Ignore tables that are views
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def defined_views
|
37
|
+
@defined_views ||= Scenic.database.views
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scenic-mysql_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lance Ivy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scenic
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: appraisal
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- lance@cainlevy.net
|
@@ -89,14 +103,22 @@ extra_rdoc_files: []
|
|
89
103
|
files:
|
90
104
|
- ".circleci/config.yml"
|
91
105
|
- ".gitignore"
|
106
|
+
- Appraisals
|
92
107
|
- CODE_OF_CONDUCT.md
|
93
108
|
- Gemfile
|
94
109
|
- README.md
|
95
110
|
- Rakefile
|
96
111
|
- bin/console
|
97
112
|
- bin/setup
|
113
|
+
- gemfiles/.bundle/config
|
114
|
+
- gemfiles/rails_42.gemfile
|
115
|
+
- gemfiles/rails_50.gemfile
|
116
|
+
- gemfiles/rails_51.gemfile
|
117
|
+
- gemfiles/rails_52.gemfile
|
98
118
|
- lib/scenic/adapters/my_sql.rb
|
119
|
+
- lib/scenic/adapters/railtie.rb
|
99
120
|
- lib/scenic/mysql_adapter.rb
|
121
|
+
- lib/scenic/mysql_adapter/schema_dumper.rb
|
100
122
|
- lib/scenic/mysql_adapter/version.rb
|
101
123
|
- lib/scenic/mysql_adapter/views.rb
|
102
124
|
- scenic-mysql_adapter.gemspec
|