cassie 1.0.6.pre1 → 1.0.6.pre2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e87e9f31fbcda1c157ea0ab6ab1448979b4c4fdc
|
4
|
+
data.tar.gz: 8d502e415d094a962000ef91d2d1b01a7372e6cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4f85555049d4ee14ca32bd328f58be26ae9a8e65a076087818076f17c78700db94f2a52570f96a8d07465dc57336945825958c40e030cd09e47440afe03370d
|
7
|
+
data.tar.gz: b9a2c4dd0851603c55f0e1aa7ebe083a13ab3d1d6f0f6b6172a92f3ac2fd4b68ad3ec3bd84f697327cc07bfdaae4058a377f30e8db7de88cdf8a954689c99240
|
data/lib/cassie/schema/README.md
CHANGED
@@ -36,7 +36,9 @@ cassie schema:init
|
|
36
36
|
|
37
37
|
If an existing schema (e.g. keyspace, tables, types) is alredy defined, see below on how to import it.
|
38
38
|
|
39
|
-
####
|
39
|
+
#### Importing an existing schema
|
40
|
+
|
41
|
+
##### Coming from `cassandra_migrations`
|
40
42
|
|
41
43
|
Import your existing `cassandra_migrations` migration files with a single task:
|
42
44
|
|
@@ -70,7 +72,7 @@ cassie migrations:import
|
|
70
72
|
|
71
73
|
> The original `cassandra_migrations` migration files and schema in the physical layer are not changed. Remove the old files when comfortable.
|
72
74
|
|
73
|
-
|
75
|
+
##### Coming from no explicit migration/versioning management
|
74
76
|
|
75
77
|
Import your existing schema held in Cassandra with a single task:
|
76
78
|
|
data/lib/cassie/tasks/io.rb
CHANGED
@@ -9,7 +9,7 @@ module Cassie::Tasks
|
|
9
9
|
|
10
10
|
return unless exception.backtrace.try(:any?)
|
11
11
|
|
12
|
-
if
|
12
|
+
if Cassie::Tasks::IO.trace?
|
13
13
|
puts " #{exception.class}:"
|
14
14
|
puts " #{exception.backtrace.join("\n ")}"
|
15
15
|
else
|
@@ -24,5 +24,13 @@ module Cassie::Tasks
|
|
24
24
|
def argv
|
25
25
|
ARGV
|
26
26
|
end
|
27
|
+
|
28
|
+
def self.trace?
|
29
|
+
!!@trace
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.trace!
|
33
|
+
@trace = true
|
34
|
+
end
|
27
35
|
end
|
28
36
|
end
|
@@ -10,11 +10,11 @@ namespace :cassie do
|
|
10
10
|
end
|
11
11
|
end.parse!(argv)
|
12
12
|
|
13
|
-
|
14
|
-
str = "Version #{version} was not found locally, can't fast-forward there
|
15
|
-
str += " Did you mean one of these local versions
|
13
|
+
def raise_not_found(version)
|
14
|
+
str = "Version #{version} was not found locally, can't fast-forward there.\n"
|
15
|
+
str += " Did you mean one of these local versions?\n" if Cassie::Schema.local_versions
|
16
16
|
Cassie::Schema.local_versions.reverse.each do |v|
|
17
|
-
str += " - #{v.to_s.ljust(10)} # #{v.description}"
|
17
|
+
str += " - #{v.to_s.ljust(10)} # #{v.description}\n"
|
18
18
|
end
|
19
19
|
raise str
|
20
20
|
end
|
@@ -22,12 +22,17 @@ namespace :cassie do
|
|
22
22
|
begin
|
23
23
|
if opts[:version]
|
24
24
|
version = Cassie::Schema::Version.new(opts[:version])
|
25
|
-
version = Cassie::Schema.local_versions.find
|
25
|
+
version = Cassie::Schema.local_versions.find{|v| version == v} || raise_not_found(version)
|
26
26
|
versions = Cassie::Schema.local_versions.select{|v| v <= version}.sort
|
27
27
|
puts "-- Fast-forwarding to version #{version}"
|
28
|
-
|
28
|
+
t0 = Time.now
|
29
|
+
versions.each.with_index do |v, i|
|
30
|
+
# space IDs out by 10 seconds to ensure they get written in order
|
31
|
+
time = t0 - (versions.count - i * 10)
|
32
|
+
v.id = ::Cassandra::TimeUuid::Generator.new.at(time)
|
33
|
+
v.executor = "cassie"
|
29
34
|
Cassie::Schema.record_version(v, false)
|
30
|
-
puts " > Recorded version #{
|
35
|
+
puts " > Recorded version #{v}"
|
31
36
|
end
|
32
37
|
puts "-- done"
|
33
38
|
|
@@ -6,9 +6,8 @@ module Cassie
|
|
6
6
|
attr_reader :command
|
7
7
|
attr_reader :options
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
@
|
11
|
-
@args = raw_args.dup
|
9
|
+
def initialize(args)
|
10
|
+
@args = args
|
12
11
|
@command = nil
|
13
12
|
@command = args.delete_at(0) if args.first =~ /\A[^-]/
|
14
13
|
@options = {}
|
@@ -18,6 +17,7 @@ module Cassie
|
|
18
17
|
build_options
|
19
18
|
Cassie.logger.level = ::Logger::WARN unless options[:debug]
|
20
19
|
Cassie.env = options[:environment] if options[:environment]
|
20
|
+
Cassie::Tasks::IO.trace! if options[:trace]
|
21
21
|
|
22
22
|
run_command || display_info
|
23
23
|
rescue OptionParser::InvalidOption => e
|
data/lib/cassie/version.rb
CHANGED