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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a22e8d604e4f7858e4d6520d192cab086915667
4
- data.tar.gz: 0cba5dca252e232b4d797a087a3eb83d662d9350
3
+ metadata.gz: 4bff930b4a33fa468da8a602a7257d5150bbda0f
4
+ data.tar.gz: 4bf17ca37a2a94645e2c0a74e14ec317207cb076
5
5
  SHA512:
6
- metadata.gz: 52986c5e6c25a82c8088a51f2667be2f7ab46d6dc1534c4eda328cff64c2a7dd93ae710b62a6f8a43409eb7aeaf98fd86ea2dd6d4cd64e667422f42c89afc5c7
7
- data.tar.gz: 11690e20f80028bbf1bdcb9afa97d1f98a27ab362e0bec3e937b5747489179f28a0d77833b26d69586b346ec789bbba8907ef94c0165152fe422d0f3c057aa2b
6
+ metadata.gz: e83a664034fc035f7f8574a10e63c2683283ed8bd03ba5a9e90d0cc8af7da4e21ed0aa84025ff27c967c27619ceffa6346cb06db6c29fa354c99018195da48c8
7
+ data.tar.gz: 2e94766dc8415ab1c4083d3edb459334423e9a764bab2fec50e3fa99102cf17d3aab99a7ffa9ba78d72131f5ac3dc013162c0b5e05d5574fde20fa278bf45b05
@@ -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
- client.execute(sql).each
74
- rescue
75
- raise ArgumentError, "Failed to apply migration from #{path}!"
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
@@ -0,0 +1,11 @@
1
+ SET ANSI_NULLS ON
2
+ SET QUOTED_IDENTIFIER ON
3
+ GO
4
+ CREATE PROCEDURE [dbo].[TestProcedure]
5
+ (
6
+ @Moo INT
7
+ )
8
+ AS
9
+ SELECT 0
10
+ GO
11
+ DROP PROCEDURE [dbo].[TestProcedure]
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.1.5
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-16 00:00:00.000000000 Z
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