migsql 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14e6bb1a65fc1946acc2bf9fef9985e6d2a0689f
4
- data.tar.gz: 6a6a2ee288e7d6209db8bc056fd0f725688267db
3
+ metadata.gz: 8a22e8d604e4f7858e4d6520d192cab086915667
4
+ data.tar.gz: 0cba5dca252e232b4d797a087a3eb83d662d9350
5
5
  SHA512:
6
- metadata.gz: 1891f297e4a680ef9b9e99f7c9470fd28b7326c2fc2da2a279ad97abe22b7d70de0086a6bebda0c6974d6022974b89138a2ac8d92a3dfc09f6d4d64e870f7832
7
- data.tar.gz: a42bee77948295fe1aa7c4013a895655fe4631fbb8f71420ba3a5a955089c29375c18aa0e6e8faae9500055da0887bbc98e2abfeefe642da71c90e3773efdfb3
6
+ metadata.gz: 52986c5e6c25a82c8088a51f2667be2f7ab46d6dc1534c4eda328cff64c2a7dd93ae710b62a6f8a43409eb7aeaf98fd86ea2dd6d4cd64e667422f42c89afc5c7
7
+ data.tar.gz: 11690e20f80028bbf1bdcb9afa97d1f98a27ab362e0bec3e937b5747489179f28a0d77833b26d69586b346ec789bbba8907ef94c0165152fe422d0f3c057aa2b
@@ -121,6 +121,7 @@ class Migration
121
121
  puts " - #{migration_name} #{updown}".white
122
122
  server = get_server(server_name)
123
123
  server.apply_migration(migration)
124
+ server.set_migration_status(migration_name) if updown.eql? 'up'
124
125
  end
125
126
 
126
127
  def get_migration_status(server_name)
@@ -69,6 +69,10 @@ class SqlServer
69
69
  def apply_migration(path)
70
70
  client = get_client
71
71
  sql = File.read(path)
72
- client.execute(sql).each
72
+ begin
73
+ client.execute(sql).each
74
+ rescue
75
+ raise ArgumentError, "Failed to apply migration from #{path}!"
76
+ end
73
77
  end
74
78
  end
@@ -1,5 +1,7 @@
1
- CREATE TABLE [dbo].[MigrationTest](
2
- [col1] [int] NOT NULL,
3
- [col2] [int] NOT NULL
4
- ) ON [PRIMARY];
5
-
1
+ IF NOT EXISTS(SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MigrationTest]') AND TYPE IN (N'U'))
2
+ BEGIN
3
+ CREATE TABLE [dbo].[MigrationTest](
4
+ [col1] [int] NOT NULL,
5
+ [col2] [int] NOT NULL
6
+ ) ON [PRIMARY];
7
+ END
@@ -1,2 +1,2 @@
1
1
  INSERT INTO MigrationTest(col1, col2)
2
- VALUES('12345', '67890')
2
+ VALUES(12345, 67890)
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.4
4
+ version: 1.1.5
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-06-16 00:00:00.000000000 Z
11
+ date: 2014-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize