scenic-mysql_adapter 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/CI.yml +40 -0
- data/.gitignore +1 -0
- data/Appraisals +27 -0
- data/LICENSE.md +19 -0
- data/README.md +4 -2
- 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/schema_dumper.rb +42 -0
- data/lib/scenic/mysql_adapter/version.rb +1 -1
- data/lib/scenic/mysql_adapter.rb +1 -0
- data/scenic-mysql_adapter.gemspec +4 -2
- metadata +41 -18
- data/.circleci/config.yml +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7a4efa149855b321c15778c6a625a329d04e325ea7b4ddf6bbc9fd7e6dac14a9
|
4
|
+
data.tar.gz: ea69e6ac7d47586f0ae375e7a74697466bbff543b4abf9364e04214129f59412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7560eef15acecfc1d3f4e18813a8ce72bae8101bebf18d5c8e4c79c2d61c103e7866f86fdc0c8af97104c43f1dc922b3be6c74abd471dd95a26cfb1077609f46
|
7
|
+
data.tar.gz: 2cb7348d28dd39e6c7d274c3bd5b762a550b593ad7def057429a4613c126bd88f9a88603951b9fbee303e5da29029fd6ab936cff30918cd58302c683f8aa5eb5
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
name: CI-tests
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
fail-fast: false
|
11
|
+
matrix:
|
12
|
+
ruby:
|
13
|
+
- '3.2'
|
14
|
+
- '3.1'
|
15
|
+
- '3.0'
|
16
|
+
- '2.7'
|
17
|
+
- '2.6'
|
18
|
+
- '2.5'
|
19
|
+
- '2.4'
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v3
|
23
|
+
|
24
|
+
- name: Setup Ruby
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
28
|
+
bundler-cache: true
|
29
|
+
|
30
|
+
- name: Start and create DB
|
31
|
+
run: |
|
32
|
+
sudo service mysql start
|
33
|
+
sleep 10
|
34
|
+
mysql -u root -proot -e "CREATE DATABASE scenic_mysql_adapter_test;"
|
35
|
+
|
36
|
+
- name: Run tests
|
37
|
+
env:
|
38
|
+
DATABASE_URL: mysql2://root:root@127.0.0.1/scenic_mysql_adapter_test
|
39
|
+
run: |
|
40
|
+
bundle exec rake test
|
data/.gitignore
CHANGED
data/Appraisals
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
appraise "rails-42" do
|
2
|
+
gem "activerecord", "~> 4.2", "< 5.0"
|
3
|
+
gem "activemodel", "~> 4.2", "< 5.0"
|
4
|
+
gem "actionpack", "~> 4.2", "< 5.0"
|
5
|
+
gem "activesupport", "~> 4.2", "< 5.0"
|
6
|
+
end
|
7
|
+
|
8
|
+
appraise "rails-50" do
|
9
|
+
gem "activerecord", "~> 5.0", "< 5.1"
|
10
|
+
gem "activemodel", "~> 5.0", "< 5.1"
|
11
|
+
gem "actionpack", "~> 5.0", "< 5.1"
|
12
|
+
gem "activesupport", "~> 5.0", "< 5.1"
|
13
|
+
end
|
14
|
+
|
15
|
+
appraise "rails-51" do
|
16
|
+
gem "activerecord", "~> 5.1", "< 5.2"
|
17
|
+
gem "activemodel", "~> 5.1", "< 5.2"
|
18
|
+
gem "actionpack", "~> 5.1", "< 5.2"
|
19
|
+
gem "activesupport", "~> 5.1", "< 5.2"
|
20
|
+
end
|
21
|
+
|
22
|
+
appraise "rails-52" do
|
23
|
+
gem "activerecord", "~> 5.2"
|
24
|
+
gem "activemodel", "~> 5.2"
|
25
|
+
gem "actionpack", "~> 5.2"
|
26
|
+
gem "activesupport", "~> 5.2"
|
27
|
+
end
|
data/LICENSE.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2019
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
MySQL adapter for [scenic](https://github.com/thoughtbot/scenic).
|
4
4
|
|
5
|
-
[![Gem](https://img.shields.io/gem/v/scenic-mysql_adapter.svg)](https://rubygems.org/gems/scenic-mysql_adapter)[![master branch](https://
|
5
|
+
[![Gem](https://img.shields.io/gem/v/scenic-mysql_adapter.svg)](https://rubygems.org/gems/scenic-mysql_adapter)[![master branch](https://github.com/EmpaticoOrg/scenic-mysql_adapter/actions/workflows/CI.yml/badge.svg)](https://github.com/EmpaticoOrg/scenic-mysql_adapter/actions/workflows/CI.yml)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -21,8 +21,10 @@ Then create the following file:
|
|
21
21
|
```ruby
|
22
22
|
# config/initializers/scenic.rb
|
23
23
|
|
24
|
+
require 'scenic/mysql_adapter'
|
25
|
+
|
24
26
|
Scenic.configure do |config|
|
25
|
-
config.database = Scenic::MySQL
|
27
|
+
config.database = Scenic::Adapters::MySQL.new
|
26
28
|
end
|
27
29
|
```
|
28
30
|
|
@@ -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
|
@@ -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
|
data/lib/scenic/mysql_adapter.rb
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{MySQL adapter for thoughtbot/scenic}
|
13
13
|
spec.homepage = "https://github.com/EmpaticoOrg/scenic-mysql_adapter"
|
14
|
+
spec.license = "MIT"
|
14
15
|
|
15
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
17
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
@@ -31,7 +32,8 @@ Gem::Specification.new do |spec|
|
|
31
32
|
spec.add_dependency "scenic", ">= 1.4.0"
|
32
33
|
spec.add_dependency "mysql2"
|
33
34
|
|
34
|
-
spec.add_development_dependency "bundler"
|
35
|
-
spec.add_development_dependency "rake"
|
35
|
+
spec.add_development_dependency "bundler"
|
36
|
+
spec.add_development_dependency "rake"
|
36
37
|
spec.add_development_dependency "minitest", "~> 5.0"
|
38
|
+
spec.add_development_dependency "appraisal"
|
37
39
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lance Ivy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scenic
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,31 +80,55 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.0'
|
83
|
-
|
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'
|
97
|
+
description:
|
84
98
|
email:
|
85
99
|
- lance@cainlevy.net
|
86
100
|
executables: []
|
87
101
|
extensions: []
|
88
102
|
extra_rdoc_files: []
|
89
103
|
files:
|
90
|
-
- ".
|
104
|
+
- ".github/workflows/CI.yml"
|
91
105
|
- ".gitignore"
|
106
|
+
- Appraisals
|
92
107
|
- CODE_OF_CONDUCT.md
|
93
108
|
- Gemfile
|
109
|
+
- LICENSE.md
|
94
110
|
- README.md
|
95
111
|
- Rakefile
|
96
112
|
- bin/console
|
97
113
|
- bin/setup
|
114
|
+
- gemfiles/.bundle/config
|
115
|
+
- gemfiles/rails_42.gemfile
|
116
|
+
- gemfiles/rails_50.gemfile
|
117
|
+
- gemfiles/rails_51.gemfile
|
118
|
+
- gemfiles/rails_52.gemfile
|
98
119
|
- lib/scenic/adapters/my_sql.rb
|
120
|
+
- lib/scenic/adapters/railtie.rb
|
99
121
|
- lib/scenic/mysql_adapter.rb
|
122
|
+
- lib/scenic/mysql_adapter/schema_dumper.rb
|
100
123
|
- lib/scenic/mysql_adapter/version.rb
|
101
124
|
- lib/scenic/mysql_adapter/views.rb
|
102
125
|
- scenic-mysql_adapter.gemspec
|
103
126
|
homepage: https://github.com/EmpaticoOrg/scenic-mysql_adapter
|
104
|
-
licenses:
|
127
|
+
licenses:
|
128
|
+
- MIT
|
105
129
|
metadata:
|
106
130
|
allowed_push_host: https://rubygems.org
|
107
|
-
post_install_message:
|
131
|
+
post_install_message:
|
108
132
|
rdoc_options: []
|
109
133
|
require_paths:
|
110
134
|
- lib
|
@@ -119,9 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
143
|
- !ruby/object:Gem::Version
|
120
144
|
version: '0'
|
121
145
|
requirements: []
|
122
|
-
|
123
|
-
|
124
|
-
signing_key:
|
146
|
+
rubygems_version: 3.1.6
|
147
|
+
signing_key:
|
125
148
|
specification_version: 4
|
126
149
|
summary: MySQL adapter for thoughtbot/scenic
|
127
150
|
test_files: []
|
data/.circleci/config.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
|
3
|
-
jobs:
|
4
|
-
build:
|
5
|
-
working_directory: ~/mysql_point
|
6
|
-
docker:
|
7
|
-
- image: circleci/ruby:2.3
|
8
|
-
environment:
|
9
|
-
DATABASE_URL: mysql2://root@127.0.0.1/circle_test
|
10
|
-
- image: circleci/mysql:5.7
|
11
|
-
|
12
|
-
steps:
|
13
|
-
- checkout
|
14
|
-
- run: bin/setup
|
15
|
-
- run: rake test
|