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: a666b2c1cd7989d7ae10dc0ffd994f7cd942d54b
4
- data.tar.gz: 94075bcf8311158255ccd5174d8b883a8004ccb1
3
+ metadata.gz: e87e9f31fbcda1c157ea0ab6ab1448979b4c4fdc
4
+ data.tar.gz: 8d502e415d094a962000ef91d2d1b01a7372e6cd
5
5
  SHA512:
6
- metadata.gz: '011389da5a2e79dfd9fd909290e109667e933d75c9465fd5be878149e7f4a8e8a682544f6d38a00697ea21a58ee0b6fefd25dea9f86f576d3271afc84a3b1c29'
7
- data.tar.gz: ca04b1f8ae1a515d51476cafb9e24e21c51300a052978818a3f18a9812dd61004bb8b5c3601559f90d31e12a8a377ac5f65ae111a5fa20e3ef30ab2f4cb7ae45
6
+ metadata.gz: b4f85555049d4ee14ca32bd328f58be26ae9a8e65a076087818076f17c78700db94f2a52570f96a8d07465dc57336945825958c40e030cd09e47440afe03370d
7
+ data.tar.gz: b9a2c4dd0851603c55f0e1aa7ebe083a13ab3d1d6f0f6b6172a92f3ac2fd4b68ad3ec3bd84f697327cc07bfdaae4058a377f30e8db7de88cdf8a954689c99240
@@ -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
- #### Coming from `cassandra_migrations`
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
- #### Coming from no explicit migration/versioning management
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
 
@@ -3,6 +3,7 @@ module Cassie::Schema
3
3
  # use fully-qualified tablename
4
4
  # for cql generation for standalone queries
5
5
  self.keyspace = nil
6
+ consistency :all
6
7
 
7
8
  insert_into "#{Cassie::Schema.schema_keyspace}.#{Cassie::Schema.versions_table}"
8
9
 
@@ -9,7 +9,7 @@ module Cassie::Tasks
9
9
 
10
10
  return unless exception.backtrace.try(:any?)
11
11
 
12
- if argv.include?("--trace")
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
- not_found = Proc.new do
14
- str = "Version #{version} was not found locally, can't fast-forward there."
15
- str += " Did you mean one of these local versions?" if Cassie::Schema.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(not_found){|v| version == v}
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
- versions.each do |v|
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 #{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(raw_args)
10
- @raw_args = raw_args
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
@@ -1,3 +1,3 @@
1
1
  module Cassie
2
- VERSION = "1.0.6.pre1"
2
+ VERSION = "1.0.6.pre2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6.pre1
4
+ version: 1.0.6.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Prothro