cassandra_migrations 0.2.7 → 1.0.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d4e59fbc000e68b5c8b7c386bec4a5915416f1
|
4
|
+
data.tar.gz: c7880ee677624568e49d0ae9ee32f27c8e87b311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c842bbb256c3386f1756323905495f5697e2a0d0ca1116b0e8543e42e1809647968056080ad057cfb4e6347742282afcfaa26c9c4b3650d846d649b51a527c0
|
7
|
+
data.tar.gz: 57392a61ed5ca9003a9c7f84389e4dba9462cff8ef7cd02632f66a8af3fca47083358d09e506e41293f7ba4e5b20539b7d183540e013ff00af341f92c8fbfd0b
|
@@ -106,28 +106,9 @@ module CassandraMigrations
|
|
106
106
|
|
107
107
|
private
|
108
108
|
|
109
|
-
SYMBOL_FOR_TYPE = {
|
110
|
-
'SetType' => :set,
|
111
|
-
'ListType' => :list,
|
112
|
-
'MapType' => :map,
|
113
|
-
'BooleanType' => :boolean,
|
114
|
-
'FloatType' => :float,
|
115
|
-
'Int32Type' => :int,
|
116
|
-
'DateType' => :timestamp,
|
117
|
-
'UTF8Type' => :string,
|
118
|
-
'BytesType' => :blob,
|
119
|
-
'UUIDType' => :uuid,
|
120
|
-
'DoubleType' => :double,
|
121
|
-
'InetAddressType' => :inet,
|
122
|
-
'AsciiType' => :ascii,
|
123
|
-
'LongType' => :bigint ,
|
124
|
-
'DecimalType' => :decimal,
|
125
|
-
'TimeUUIDType' => :timeuuid
|
126
|
-
}
|
127
|
-
|
128
109
|
def get_column_type(table, column)
|
129
|
-
|
130
|
-
|
110
|
+
column_type = client.execute("SELECT type FROM system_schema.columns WHERE keyspace_name = '#{client.keyspace}' AND table_name = '#{table}' AND column_name = '#{column}'").first['type']
|
111
|
+
column_type.split("<").first.to_sym
|
131
112
|
end
|
132
113
|
|
133
114
|
def to_cql_value(column, value, table, options={})
|
@@ -35,6 +35,22 @@ module CassandraMigrations
|
|
35
35
|
|
36
36
|
execute create_cql
|
37
37
|
end
|
38
|
+
|
39
|
+
def alter_table(table_name, options={})
|
40
|
+
table_definition = TableDefinition.new
|
41
|
+
table_definition.define_options(options[:options]) if options[:options]
|
42
|
+
|
43
|
+
yield table_definition if block_given?
|
44
|
+
|
45
|
+
announce_operation "alter_table #{table_name}"
|
46
|
+
|
47
|
+
create_cql = "ALTER TABLE #{table_name}"
|
48
|
+
create_cql << table_definition.options
|
49
|
+
|
50
|
+
announce_suboperation create_cql
|
51
|
+
|
52
|
+
execute create_cql
|
53
|
+
end
|
38
54
|
|
39
55
|
def create_index(table_name, column_name, options = {})
|
40
56
|
announce_operation "create_index(#{table_name})"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cassandra_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrique Gubert
|
@@ -18,9 +18,6 @@ dependencies:
|
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3.0'
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 2.1.1
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,9 +25,6 @@ dependencies:
|
|
28
25
|
- - "~>"
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '3.0'
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 2.1.1
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: rake
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
210
|
version: 1.8.0
|
217
211
|
requirements: []
|
218
212
|
rubyforge_project:
|
219
|
-
rubygems_version: 2.
|
213
|
+
rubygems_version: 2.6.8
|
220
214
|
signing_key:
|
221
215
|
specification_version: 4
|
222
216
|
summary: Cassandra schema management for a multi-environment developer.
|