activerecord-migrations 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa7e7643d0616dfdecbd02fb91bf7ff1aac5b0980ba4448628f97adc5e3cb96e
4
- data.tar.gz: '098fff5904d41f5b8f3980b1f19eb1a23bb41d97958741f6450a537779a80536'
3
+ metadata.gz: 0a63e0a40b3bb11fb0472d0a71507223943732350ed7ff7d9f093c45a69b30d9
4
+ data.tar.gz: 5b28d403e9d8e2b6d798fa5730f6213d977bfea59708eccf8c0f3b7b33e8d565
5
5
  SHA512:
6
- metadata.gz: a54507fd8c2434bda2b11fb4e8d81dfb6cd49ebf8592dec1b781bcd7a43e1682229cd082f71fd46c4f269f9a1d398c7f3e63ecdd046df288734aa371fd6221ad
7
- data.tar.gz: 3cb7fc34db27c1e4cbdc068bf8ced5ec84a23967bde83f825c37a09e9528484d5b98fdfee7a7f291cf2b91fcb0b47658d12300b848f25a53314cec0f5d907cc9
6
+ metadata.gz: 79eb1392d02d5ae1bbf82cbd4a33145ce98ebe0f64f3e5f71ca1a00bfe43f2a62e9a5e3c28d10b615ef40a99996a820f00f9cccaa56a808791605783b160716a
7
+ data.tar.gz: 4bdfb2ece3ef87131dacfc03534f8c261bfd6f4c5290edd2271904edf9a5f92340b355ea0e4dc01adb9fc066056051bf2d1c57f71872e58747d64400970a64c5
@@ -0,0 +1,6 @@
1
+
2
+ def deploy
3
+ call('activerecord:environment')
4
+
5
+ Rake::Task['db:deploy'].invoke
6
+ end
@@ -0,0 +1,9 @@
1
+
2
+ def environment
3
+ super
4
+
5
+ require 'active_record/migrations/tasks'
6
+
7
+ # The root must be the root of your application, and contain `db/`.
8
+ ActiveRecord::Migrations.root = context.root
9
+ end
@@ -18,6 +18,13 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require 'rake'
22
+ require 'variant'
23
+
24
+ task :environment do
25
+ # Can be overriden by user.
26
+ end
27
+
21
28
  namespace :db do
22
29
  task :load_config => :environment do
23
30
  database_tasks = ActiveRecord::Tasks::DatabaseTasks
@@ -26,9 +33,8 @@ namespace :db do
26
33
  abort "ActiveRecord::Migrations.root needs to be set!"
27
34
  end
28
35
 
29
- unless DATABASE_ENV
30
- abort "DATABASE_ENV needs to be set!"
31
- end
36
+ # DATABASE_ENV is a legacy environment variable:
37
+ variant = Variant.for(:database) || DATABASE_ENV
32
38
 
33
39
  if ActiveRecord::Base.configurations.empty?
34
40
  abort "ActiveRecord::Base.configurations needs to be setup!"
@@ -36,10 +42,10 @@ namespace :db do
36
42
 
37
43
  database_tasks.root = root
38
44
  database_tasks.db_dir = File.join(root, 'db')
39
- database_tasks.env = DATABASE_ENV.to_s
45
+ database_tasks.env = variant.to_s
40
46
  database_tasks.database_configuration = ActiveRecord::Base.configurations
41
47
  database_tasks.migrations_paths = [File.join(root, 'db/migrate')]
42
- database_tasks.fixtures_path = File.join(root, 'db/fixtures', DATABASE_ENV.to_s)
48
+ database_tasks.fixtures_path = File.join(root, 'db/fixtures', variant.to_s)
43
49
 
44
50
  database_tasks.send(:define_method, :load_seed) do
45
51
  load File.join(root, 'db/seed.rb')
@@ -20,6 +20,6 @@
20
20
 
21
21
  module ActiveRecord
22
22
  module Migrations
23
- VERSION = "1.4.0"
23
+ VERSION = "1.5.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-15 00:00:00.000000000 Z
11
+ date: 2020-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -59,7 +59,35 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.0'
61
61
  - !ruby/object:Gem::Dependency
62
- name: covered
62
+ name: variant
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: bake-bundler
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: bake-modernize
63
91
  requirement: !ruby/object:Gem::Requirement
64
92
  requirements:
65
93
  - - ">="
@@ -86,6 +114,20 @@ dependencies:
86
114
  - - ">="
87
115
  - !ruby/object:Gem::Version
88
116
  version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: covered
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
89
131
  - !ruby/object:Gem::Dependency
90
132
  name: rake
91
133
  requirement: !ruby/object:Gem::Requirement
@@ -114,22 +156,14 @@ dependencies:
114
156
  - - "~>"
115
157
  - !ruby/object:Gem::Version
116
158
  version: '3.0'
117
- description:
159
+ description:
118
160
  email:
119
- - samuel.williams@oriontransfer.co.nz
120
161
  executables: []
121
162
  extensions: []
122
163
  extra_rdoc_files: []
123
164
  files:
124
- - ".gitignore"
125
- - ".rspec"
126
- - ".travis.yml"
127
- - Gemfile
128
- - README.md
129
- - Rakefile
130
- - activerecord-migrations.gemspec
131
- - gems/rails5.gemfile
132
- - gems/rails6.gemfile
165
+ - bake/activerecord/deploy.rb
166
+ - bake/activerecord/environment.rb
133
167
  - lib/active_record/migrations.rb
134
168
  - lib/active_record/migrations/generator.rb
135
169
  - lib/active_record/migrations/tasks.rb
@@ -141,8 +175,9 @@ files:
141
175
  homepage: https://github.com/ioquatix/activerecord-migrations
142
176
  licenses:
143
177
  - MIT
144
- metadata: {}
145
- post_install_message:
178
+ metadata:
179
+ funding_uri: https://github.com/sponsors/ioquatix/
180
+ post_install_message:
146
181
  rdoc_options: []
147
182
  require_paths:
148
183
  - lib
@@ -157,8 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
192
  - !ruby/object:Gem::Version
158
193
  version: '0'
159
194
  requirements: []
160
- rubygems_version: 3.0.4
161
- signing_key:
195
+ rubygems_version: 3.1.2
196
+ signing_key:
162
197
  specification_version: 4
163
198
  summary: Provides a opinionated migration wrapper for ActiveRecord 5+
164
199
  test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
- Gemfile.lock
13
- .covered.db
14
-
15
- spec/active_record/project/db/development.db
16
- spec/active_record/project/db/schema.rb
17
-
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --format documentation
2
- --color
3
- --warnings
4
- --require spec_helper
@@ -1,25 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rvm: 2.4
8
- gemfile: gems/rails5.gemfile
9
- - rvm: 2.5
10
- gemfile: gems/rails5.gemfile
11
- - rvm: 2.6
12
- gemfile: gems/rails5.gemfile
13
- - rvm: 2.6
14
- gemfile: gems/rails6.gemfile
15
- - rvm: 2.6
16
- gemfile: gems/rails5.gemfile
17
- env: COVERAGE=PartialSummary,Coveralls
18
- - rvm: truffleruby
19
- - rvm: jruby-head
20
- env: JRUBY_OPTS="--debug -X+O"
21
- - rvm: ruby-head
22
- allow_failures:
23
- - rvm: truffleruby
24
- - rvm: ruby-head
25
- - rvm: jruby-head
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in activerecord-migrations.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem "sqlite3"
8
- gem "mysql2"
9
- end
data/README.md DELETED
@@ -1,99 +0,0 @@
1
- # ActiveRecord::Migrations
2
-
3
- This gem provides opinionated support for ActiveRecord migrations in non-Rails applications. It's more opinionated than [active_record_migrations](https://github.com/rosenfeld/active_record_migrations) and [standalone-migrations](https://github.com/thuss/standalone-migrations), and therefore simpler to configure.
4
-
5
- [![Build Status](https://travis-ci.com/ioquatix/activerecord-migrations.svg)](https://travis-ci.com/ioquatix/activerecord-migrations)
6
- [![Code Climate](https://codeclimate.com/github/ioquatix/activerecord-migrations.svg)](https://codeclimate.com/github/ioquatix/activerecord-migrations)
7
- [![Coverage Status](https://coveralls.io/repos/ioquatix/activerecord-migrations/badge.svg)](https://coveralls.io/r/ioquatix/activerecord-migrations)
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'activerecord-migrations'
15
- ```
16
-
17
- ## Usage
18
-
19
- Add something like this to `tasks/db.rake`
20
-
21
- ```ruby
22
- require 'active_record/migrations/tasks'
23
- # The root must be the root of your application, and contain `db/`.
24
- ActiveRecord::Migrations.root = File.dirname(__dir__)
25
- ```
26
-
27
- Somewhere else, ensure you have a suitable `environment` task, e.g:
28
-
29
- ```ruby
30
- task :environment do
31
- # This must be a symbol... or establish_connection thinks it's a URL.
32
- DATABASE_ENV = :development
33
-
34
- ActiveRecord::Base.configurations = {
35
- # This key must be a string or it will not be matched by ActiveRecord:
36
- 'development' => {
37
- # Using symbols for keys is fixed by this gem.
38
- adapter: 'sqlite3',
39
- database: 'db/development.db'
40
- }
41
- }
42
-
43
- # Connect to database:
44
- unless ActiveRecord::Base.connected?
45
- ActiveRecord::Base.establish_connection(DATABASE_ENV)
46
- end
47
- end
48
- ```
49
-
50
- ### Deployment
51
-
52
- This gem includes an additional task `db:deploy` which is designed to assist with deployment of sites with databases. When deploying a site for the first time, this task will create the database and load the seed data, then run any outstanding migrations. If deploying the site to an existing database it will simply run migrations.
53
-
54
- The typical usage is to run `db:fixtures:update` which will generate all the required files into `db/fixtures/$DATABASE/`, which includes the contents of all tables and the current `schema.rb`.
55
-
56
- ### Fixtures
57
-
58
- Fixtures are generated into `db/fixtures/$DATABASE_ENV/$TABLE_NAME.yml` by running `rake db:fixtures:dump`. You can limit this to specific tables by editing `db/fixtures/$DATABASE_ENV/tables.conf` which is loaded if present, or by specifying `TABLES=table1,table2` environment variable.
59
-
60
- ### Seed
61
-
62
- This gem replaces the existing data seed mechanism with `db:fixtures:load`.
63
-
64
- ## Contributing
65
-
66
- 1. Fork it
67
- 2. Create your feature branch (`git checkout -b my-new-feature`)
68
- 3. Commit your changes (`git commit -am 'Add some feature'`)
69
- 4. Push to the branch (`git push origin my-new-feature`)
70
- 5. Create new Pull Request
71
-
72
- ## See Also
73
-
74
- - [ActiveRecord::Rack](https://github.com/ioquatix/activerecord-rack)
75
-
76
- ## License
77
-
78
- Released under the MIT license.
79
-
80
- Copyright, 2016, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
81
-
82
- Permission is hereby granted, free of charge, to any person obtaining a copy
83
- of this software and associated documentation files (the "Software"), to deal
84
- in the Software without restriction, including without limitation the rights
85
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
86
- copies of the Software, and to permit persons to whom the Software is
87
- furnished to do so, subject to the following conditions:
88
-
89
- The above copyright notice and this permission notice shall be included in
90
- all copies or substantial portions of the Software.
91
-
92
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
98
- THE SOFTWARE.
99
-
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new
5
-
6
- task :default => :spec
@@ -1,30 +0,0 @@
1
- # coding: utf-8
2
- require_relative 'lib/active_record/migrations/version'
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "activerecord-migrations"
6
- spec.version = ActiveRecord::Migrations::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
-
10
- spec.summary = %q{Provides a opinionated migration wrapper for ActiveRecord 5+}
11
- spec.homepage = "https://github.com/ioquatix/activerecord-migrations"
12
- spec.license = "MIT"
13
-
14
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
15
- f.match(%r{^(test|spec|features)/})
16
- end
17
- spec.bindir = "exe"
18
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_dependency "activerecord", ">= 5", "< 7"
22
- spec.add_dependency "railties"
23
-
24
- spec.add_dependency "rainbow", "~> 2.0"
25
-
26
- spec.add_development_dependency "covered"
27
- spec.add_development_dependency "bundler"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
30
- end
@@ -1,4 +0,0 @@
1
-
2
- eval_gemfile("../Gemfile")
3
-
4
- gem 'activerecord', '~> 5.0'
@@ -1,4 +0,0 @@
1
-
2
- eval_gemfile("../Gemfile")
3
-
4
- gem 'activerecord', '~> 6.0'