migsql 1.1.5 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/migsql/sqlserver.rb +12 -3
- data/sql/statement_containing_go.sql +11 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bff930b4a33fa468da8a602a7257d5150bbda0f
|
4
|
+
data.tar.gz: 4bf17ca37a2a94645e2c0a74e14ec317207cb076
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e83a664034fc035f7f8574a10e63c2683283ed8bd03ba5a9e90d0cc8af7da4e21ed0aa84025ff27c967c27619ceffa6346cb06db6c29fa354c99018195da48c8
|
7
|
+
data.tar.gz: 2e94766dc8415ab1c4083d3edb459334423e9a764bab2fec50e3fa99102cf17d3aab99a7ffa9ba78d72131f5ac3dc013162c0b5e05d5574fde20fa278bf45b05
|
data/lib/migsql/sqlserver.rb
CHANGED
@@ -66,13 +66,22 @@ class SqlServer
|
|
66
66
|
client.execute('DROP TABLE _migration')
|
67
67
|
end
|
68
68
|
|
69
|
+
# This method will parse some SSMS stuff, such as GO
|
70
|
+
def parse_sql(sql)
|
71
|
+
sql.split(/go\n/i)
|
72
|
+
end
|
73
|
+
|
69
74
|
def apply_migration(path)
|
70
75
|
client = get_client
|
71
76
|
sql = File.read(path)
|
72
77
|
begin
|
73
|
-
|
74
|
-
|
75
|
-
|
78
|
+
sql = parse_sql(sql)
|
79
|
+
sql.each do |statement|
|
80
|
+
client.execute(statement).each
|
81
|
+
end
|
82
|
+
rescue Exception => e
|
83
|
+
puts "Failed to apply migration from #{path}!".red
|
84
|
+
raise e
|
76
85
|
end
|
77
86
|
end
|
78
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: migsql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Stoney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- lib/migsql/sqlserver.rb
|
37
37
|
- lib/migsql.rb
|
38
38
|
- bin/migsql
|
39
|
+
- sql/statement_containing_go.sql
|
39
40
|
- sql/create_migration_table.sql
|
40
41
|
- sql/populate_test_table.sql
|
41
42
|
- sql/create_test_table.sql
|