activerecord-migrations 1.0.0.pre.rc1 → 1.0.0.pre.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -5
- data/activerecord-migrations.gemspec +1 -1
- data/lib/active_record/migrations.rb +26 -0
- data/lib/active_record/migrations/tasks.rb +36 -0
- data/lib/{activerecord → active_record}/migrations/tasks/db.rb +19 -0
- data/lib/active_record/migrations/tasks/db/migrations.rb +41 -0
- data/lib/active_record/migrations/version.rb +25 -0
- metadata +6 -6
- data/lib/activerecord/migrations.rb +0 -7
- data/lib/activerecord/migrations/tasks.rb +0 -17
- data/lib/activerecord/migrations/tasks/db/migrations.rb +0 -22
- data/lib/activerecord/migrations/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e2379b874bf520a0e2cd2a5fbec506153fcd6f
|
4
|
+
data.tar.gz: eb5a1b839409043cdc1e63a9889106b3a0e6c3c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ef83bea0034a256195400078d2ee29ca1575fc94505dc98b769af5081939bf9ee087afcb0bb430d583cfcfb1354bc23ec78bafa180ae7bd3e21f10aa0cb303
|
7
|
+
data.tar.gz: 50a07fbf8f8cc651d3ac025b50f9248e10a0b309e6de189f361aee46d13d18bbbcd1ddaf96a84548ec8141bf164f38477ffd6153c8b33bf799149e2f45f58bf1
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# ActiveRecord::Migrations
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
This gem provides opinionated support for ActiveRecord migrations in non-Rails applications. It's faster and better defined than the competing gems, but only supports ActiveRecord 5+.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -14,10 +12,29 @@ gem 'activerecord-migrations'
|
|
14
12
|
|
15
13
|
## Usage
|
16
14
|
|
17
|
-
Add this to `tasks/db.rake`
|
15
|
+
Add something like this to `tasks/db.rake`
|
18
16
|
|
19
17
|
```ruby
|
20
|
-
|
18
|
+
task :environment do
|
19
|
+
# This must be a symbol... or establish_connection thinks it's a URL.
|
20
|
+
DATABASE_ENV = :development
|
21
|
+
|
22
|
+
ActiveRecord::Base.configurations = {
|
23
|
+
# This key must be a string or it will not be matched by ActiveRecord:
|
24
|
+
'development' => {
|
25
|
+
'adapter' => 'sqlite3',
|
26
|
+
# This key must be a string or rake tasks will fail (e.g. each_current_configuration fails):
|
27
|
+
'database' => 'db/development.db'
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
# Connect to database:
|
32
|
+
unless ActiveRecord::Base.connected?
|
33
|
+
ActiveRecord::Base.establish_connection(DATABASE_ENV)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
require 'active_record/migrations'
|
21
38
|
ActiveRecord::Migrations.root = File.expand_path("../db", __dir__)
|
22
39
|
```
|
23
40
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'active_record/migrations/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "activerecord-migrations"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all 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
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require_relative "migrations/version"
|
22
|
+
|
23
|
+
module ActiveRecord
|
24
|
+
module Migrations
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all 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
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require_relative 'tasks/db'
|
22
|
+
require_relative 'tasks/db/migrations'
|
23
|
+
|
24
|
+
module ActiveRecord
|
25
|
+
module Migrations
|
26
|
+
class << self
|
27
|
+
attr_accessor :root
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.database?
|
31
|
+
!ActiveRecord::Base.connection.data_sources.empty?
|
32
|
+
rescue ActiveRecord::NoDatabaseError
|
33
|
+
false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,3 +1,22 @@
|
|
1
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all 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
|
19
|
+
# THE SOFTWARE.
|
1
20
|
|
2
21
|
namespace :db do
|
3
22
|
task :load_config => :environment do
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all 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
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
namespace :db do
|
22
|
+
namespace :migrations do
|
23
|
+
desc "Creates a new migration file with the specified name"
|
24
|
+
task :new, :name, :options do |t, args|
|
25
|
+
unless name = args[:name] || ENV['name']
|
26
|
+
abort "You must provide a name of the migration to generate"
|
27
|
+
end
|
28
|
+
|
29
|
+
if options = args[:options] || ENV['options']
|
30
|
+
options = options.split('/')
|
31
|
+
else
|
32
|
+
options = []
|
33
|
+
end
|
34
|
+
|
35
|
+
require "rails/generators"
|
36
|
+
|
37
|
+
parameters = [name] + options
|
38
|
+
Rails::Generators.invoke "active_record:migration", parameters, :destination_root => ActiveRecord::Migrations.root
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all 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
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
module ActiveRecord
|
22
|
+
module Migrations
|
23
|
+
VERSION = "1.0.0-rc2"
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.
|
4
|
+
version: 1.0.0.pre.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -94,11 +94,11 @@ files:
|
|
94
94
|
- README.md
|
95
95
|
- Rakefile
|
96
96
|
- activerecord-migrations.gemspec
|
97
|
-
- lib/
|
98
|
-
- lib/
|
99
|
-
- lib/
|
100
|
-
- lib/
|
101
|
-
- lib/
|
97
|
+
- lib/active_record/migrations.rb
|
98
|
+
- lib/active_record/migrations/tasks.rb
|
99
|
+
- lib/active_record/migrations/tasks/db.rb
|
100
|
+
- lib/active_record/migrations/tasks/db/migrations.rb
|
101
|
+
- lib/active_record/migrations/version.rb
|
102
102
|
homepage: https://github.com/ioquatix/activerecord-migrations
|
103
103
|
licenses:
|
104
104
|
- MIT
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'tasks/db'
|
3
|
-
require_relative 'tasks/db/migrations'
|
4
|
-
|
5
|
-
module ActiveRecord
|
6
|
-
module Migrations
|
7
|
-
class << self
|
8
|
-
attr_accessor :root
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.database?
|
12
|
-
!ActiveRecord::Base.connection.data_sources.empty?
|
13
|
-
rescue ActiveRecord::NoDatabaseError
|
14
|
-
false
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
namespace :db do
|
3
|
-
namespace :migrations do
|
4
|
-
desc "Creates a new migration file with the specified name"
|
5
|
-
task :new, :name, :options do |t, args|
|
6
|
-
unless name = args[:name] || ENV['name']
|
7
|
-
abort "You must provide a name of the migration to generate"
|
8
|
-
end
|
9
|
-
|
10
|
-
if options = args[:options] || ENV['options']
|
11
|
-
options = options.split('/')
|
12
|
-
else
|
13
|
-
options = []
|
14
|
-
end
|
15
|
-
|
16
|
-
require "rails/generators"
|
17
|
-
|
18
|
-
parameters = [name] + options
|
19
|
-
Rails::Generators.invoke "active_record:migration", parameters, :destination_root => ActiveRecord::Migrations.root
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|