data_migrate 5.1.0 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/data_migrate/data_migrator.rb +12 -12
- data/lib/data_migrate/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aae65effdc868c62166684eabdeb9ab2799aa4804b6172fe4ff541b1193fba54
|
4
|
+
data.tar.gz: 3c50deaf50da13456a9e078ae0df07d269335b312863c88b0807f58bb3fdcffa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 650d0315aa2cbb3549fdd1104bf2f471a141519aee4b51589a988b027e496a4ea8659b160e651a5f8b9a88cd7fe6a41822e0de65b96e3e01591bdef4cac3e3c7
|
7
|
+
data.tar.gz: 21f4a447c422b8470a4968a48b6e9e56fdcf798bff9f92ef2dcf1a84283d6c790f73dd1d54c0992e15cec11ca4ac10b0ec429a7fe68d5f28fb70e2a7d4119d17
|
@@ -3,16 +3,15 @@
|
|
3
3
|
require "active_record"
|
4
4
|
|
5
5
|
module DataMigrate
|
6
|
-
|
7
6
|
class DataMigrator < ActiveRecord::Migrator
|
8
7
|
|
9
8
|
def record_version_state_after_migrating(version)
|
10
9
|
if down?
|
11
10
|
migrated.delete(version)
|
12
|
-
DataMigrate::DataSchemaMigration.where(:
|
11
|
+
DataMigrate::DataSchemaMigration.where(version: version.to_s).delete_all
|
13
12
|
else
|
14
13
|
migrated << version
|
15
|
-
DataMigrate::DataSchemaMigration.create!(:
|
14
|
+
DataMigrate::DataSchemaMigration.create!(version: version.to_s)
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
@@ -70,17 +69,18 @@ module DataMigrate
|
|
70
69
|
private
|
71
70
|
|
72
71
|
def create_table(sm_table)
|
73
|
-
ActiveRecord::Base.connection.create_table(sm_table, :
|
74
|
-
|
75
|
-
|
72
|
+
ActiveRecord::Base.connection.create_table(sm_table, id: false) do |schema_migrations_table|
|
73
|
+
schema_migrations_table.column :version, :string, null: false
|
74
|
+
end
|
75
|
+
|
76
|
+
suffix = ActiveRecord::Base.table_name_suffix
|
77
|
+
prefix = ActiveRecord::Base.table_name_prefix
|
78
|
+
index_name = "#{prefix}unique_data_migrations#{suffix}"
|
76
79
|
|
77
|
-
|
78
|
-
|
79
|
-
index_name = "#{prefix}unique_data_migrations#{suffix}"
|
80
|
+
options = {unique: true, name: index_name}
|
81
|
+
options[:length] = 191 if ActiveRecord::Base.connection_config[:adapter] == "mysql2"
|
80
82
|
|
81
|
-
|
82
|
-
:unique => true,
|
83
|
-
:name => index_name
|
83
|
+
ActiveRecord::Base.connection.add_index sm_table, :version, options
|
84
84
|
end
|
85
85
|
|
86
86
|
def table_exists?(connection, table_name)
|
data/lib/data_migrate/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_migrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew J Vargo
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-10-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
275
|
version: '0'
|
276
276
|
requirements: []
|
277
277
|
rubyforge_project: data_migrate
|
278
|
-
rubygems_version: 2.
|
278
|
+
rubygems_version: 2.7.4
|
279
279
|
signing_key:
|
280
280
|
specification_version: 4
|
281
281
|
summary: Rake tasks to migrate data alongside schema changes.
|