migsql 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/migsql/migration.rb +1 -0
- data/lib/migsql/sqlserver.rb +5 -1
- data/sql/create_test_table.sql +7 -5
- data/sql/populate_test_table.sql +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a22e8d604e4f7858e4d6520d192cab086915667
|
4
|
+
data.tar.gz: 0cba5dca252e232b4d797a087a3eb83d662d9350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52986c5e6c25a82c8088a51f2667be2f7ab46d6dc1534c4eda328cff64c2a7dd93ae710b62a6f8a43409eb7aeaf98fd86ea2dd6d4cd64e667422f42c89afc5c7
|
7
|
+
data.tar.gz: 11690e20f80028bbf1bdcb9afa97d1f98a27ab362e0bec3e937b5747489179f28a0d77833b26d69586b346ec789bbba8907ef94c0165152fe422d0f3c057aa2b
|
data/lib/migsql/migration.rb
CHANGED
@@ -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)
|
data/lib/migsql/sqlserver.rb
CHANGED
@@ -69,6 +69,10 @@ class SqlServer
|
|
69
69
|
def apply_migration(path)
|
70
70
|
client = get_client
|
71
71
|
sql = File.read(path)
|
72
|
-
|
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
|
data/sql/create_test_table.sql
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
[
|
4
|
-
|
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
|
data/sql/populate_test_table.sql
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
INSERT INTO MigrationTest(col1, col2)
|
2
|
-
VALUES(
|
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
|
+
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-
|
11
|
+
date: 2014-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|