cassie 1.1.0.pre2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cassie/schema/README.md +29 -18
- data/lib/cassie/schema/migrator.rb +0 -1
- data/lib/cassie/schema/structure_dumper.rb +1 -0
- data/lib/cassie/schema/structure_loader.rb +17 -15
- data/lib/cassie/tasks/schema/load.rake +1 -1
- data/lib/cassie/tasks/task_runner.rb +5 -5
- data/lib/cassie/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c69c7faad6e465a92ab097dc7df5a471585694e1
|
4
|
+
data.tar.gz: cb03bcbb2b28029fd977d9709085b741e6606d60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d120d17ebd793fcb0ff7c3387fc3b1b10e6eaaf1003dab3b4b579414582cc47397ffde20c5f2b7fef689e02005f21a528abbe7cf0706f12faf819f60dfc38ac
|
7
|
+
data.tar.gz: 6f09e37b7e431609c0a8184d494e12a2f9b2e6c39e9f8955149d65653fe2014327204963cae78d55dff83ab8b966484a14ce2bced676c59bac8b0c63d73ab146
|
data/lib/cassie/schema/README.md
CHANGED
@@ -48,7 +48,7 @@ cassie migrations:import
|
|
48
48
|
```bash
|
49
49
|
-- Initializing Cassie Versioning
|
50
50
|
-- done
|
51
|
-
-- Initializing '
|
51
|
+
-- Initializing 'my_app_development' Keyspace
|
52
52
|
-- done
|
53
53
|
-- Importing `cassandra_migrations` migration files
|
54
54
|
- Importing db/cassandra_migrate/20161206214301_initial_database.rb
|
@@ -102,7 +102,7 @@ cassie schema:import
|
|
102
102
|
|
103
103
|
Locally, these import tasks will also initialiaze the local version tracking to have all migration versions recorded.
|
104
104
|
|
105
|
-
However, another developer's or environment's database does not have this schema metadata. Syncronize version tracking by initializing cassie schema with the version of the current in-database schema.
|
105
|
+
However, another developer's or environment's database does not have this schema metadata. Syncronize version tracking for these databases by initializing cassie schema with the version of the current in-database schema.
|
106
106
|
|
107
107
|
```
|
108
108
|
cassie schema:init -v 0.0.2.0
|
@@ -116,7 +116,7 @@ cassie schema:init -v 0.0.2.0
|
|
116
116
|
> Recorded version 0.0.1.0
|
117
117
|
> Recorded version 0.0.2.0
|
118
118
|
-- done
|
119
|
-
-- Initializing '
|
119
|
+
-- Initializing 'my_app_development' Keyspace
|
120
120
|
-- done
|
121
121
|
```
|
122
122
|
|
@@ -172,7 +172,7 @@ cassie migrate 0.2.0
|
|
172
172
|
|
173
173
|
##### Rolling back
|
174
174
|
|
175
|
-
Use the same
|
175
|
+
Use the same command to migrate up or down to a specific version.
|
176
176
|
|
177
177
|
```
|
178
178
|
cassie migrate 0.1.9
|
@@ -184,6 +184,8 @@ cassie schema:version
|
|
184
184
|
```
|
185
185
|
```
|
186
186
|
+-----------+----------------+-------------+---------------------------+
|
187
|
+
| Environment: development |
|
188
|
+
+-----------+----------------+-------------+---------------------------+
|
187
189
|
| Version | Description | Migrated by | Migrated at |
|
188
190
|
+-----------+----------------+-------------+---------------------------+
|
189
191
|
| * 0.2.0.0 | create users | serverbot | 2016-09-08 10:23:54 -0500 |
|
@@ -196,6 +198,8 @@ cassie schema:history
|
|
196
198
|
```
|
197
199
|
```
|
198
200
|
+-----------+----------------+-------------+---------------------------+
|
201
|
+
| Environment: development |
|
202
|
+
+-----------+----------------+-------------+---------------------------+
|
199
203
|
| Version | Description | Migrated by | Migrated at |
|
200
204
|
+-----------+----------------+-------------+---------------------------+
|
201
205
|
| * 0.2.0.0 | create users | serverbot | 2016-09-08 10:23:54 -0500 |
|
@@ -212,6 +216,8 @@ cassie schema:status
|
|
212
216
|
```
|
213
217
|
```
|
214
218
|
+-----------+----------------+--------+---------------------------------------------------------------+
|
219
|
+
| Environment: development |
|
220
|
+
+-----------+----------------+--------+---------------------------------------------------------------+
|
215
221
|
| Number | Description | Status | Migration File |
|
216
222
|
+-----------+----------------+--------+---------------------------------------------------------------+
|
217
223
|
| 0.0.3.0 | create friends | DOWN | db/cassandra/migrations/0000_0000_0003_0000_create_friends.rb |
|
@@ -231,7 +237,7 @@ It is updated (with a full dump) after each migration, to maintain a truth-store
|
|
231
237
|
cassie schema:dump
|
232
238
|
```
|
233
239
|
```
|
234
|
-
-- Dumping
|
240
|
+
-- Dumping 'development' schema (version 0.2.0.0)
|
235
241
|
- Writing to db/cassandra/schema.rb
|
236
242
|
- done
|
237
243
|
-- done
|
@@ -242,10 +248,11 @@ cassie schema:dump
|
|
242
248
|
cassie schema:drop
|
243
249
|
```
|
244
250
|
```
|
245
|
-
-- Dropping
|
251
|
+
-- Dropping 'development' schema
|
246
252
|
- Dropping 'my_app_development'
|
247
253
|
- done
|
248
|
-
-
|
254
|
+
- Clearning schema version metadata
|
255
|
+
> removed 2 versions
|
249
256
|
- done
|
250
257
|
-- done
|
251
258
|
```
|
@@ -255,7 +262,7 @@ cassie schema:drop
|
|
255
262
|
cassie schema:load
|
256
263
|
```
|
257
264
|
```
|
258
|
-
-- Loading
|
265
|
+
-- Loading 'development' schema from db/cassandra/schema.rb
|
259
266
|
> Schema is now at version 0.2.0.0
|
260
267
|
-- done
|
261
268
|
```
|
@@ -266,13 +273,14 @@ cassie schema:load
|
|
266
273
|
cassie schema:reset
|
267
274
|
```
|
268
275
|
```
|
269
|
-
-- Dropping
|
276
|
+
-- Dropping 'development' schema
|
270
277
|
- Dropping 'my_app_development'
|
271
278
|
- done
|
272
|
-
-
|
279
|
+
- Clearning schema version metadata
|
280
|
+
> removed 2 versions
|
273
281
|
- done
|
274
282
|
-- done
|
275
|
-
-- Loading
|
283
|
+
-- Loading 'development' schema from db/cassandra/schema.rb
|
276
284
|
> Schema is now at version 0.2.0.0
|
277
285
|
-- done
|
278
286
|
```
|
@@ -285,26 +293,27 @@ This task reload the schema from the schema file, and then proceeds with increme
|
|
285
293
|
cassie migrate:reset
|
286
294
|
```
|
287
295
|
```
|
288
|
-
-- Dropping
|
289
|
-
- Dropping '
|
296
|
+
-- Dropping 'development' schema
|
297
|
+
- Dropping 'my_app_development'
|
290
298
|
- done
|
291
|
-
-
|
299
|
+
- Clearning schema version metadata
|
300
|
+
> removed 2 versions
|
292
301
|
- done
|
293
302
|
-- done
|
294
|
-
-- Loading
|
303
|
+
-- Loading 'development' schema from db/cassandra/schema.rb
|
295
304
|
> Schema is now at version 0.2.0.0
|
296
305
|
-- done
|
297
|
-
-- Migrating to version 0.2.1.0
|
306
|
+
-- Migrating 'development' schema to version 0.2.1.0
|
298
307
|
- Migragting version 0.2.1.0 UP
|
299
308
|
- done (4.89 ms)
|
300
309
|
-- done
|
301
|
-
-- Dumping
|
310
|
+
-- Dumping 'development' schema (version 0.2.1.0)
|
302
311
|
- Writing to db/cassandra/schema.rb
|
303
312
|
- done
|
304
313
|
-- done
|
305
314
|
```
|
306
315
|
|
307
|
-
###
|
316
|
+
### Managing Envrionments
|
308
317
|
|
309
318
|
Set the environment with `RACK_ENV`, `CASSANDRA_ENV` or the `--env`(`-e`) switch for `cassie` commands:
|
310
319
|
|
@@ -316,6 +325,8 @@ is equivalent to
|
|
316
325
|
cassie migrate:reset -e test
|
317
326
|
```
|
318
327
|
|
328
|
+
The `schema.rb` file contains keyspace-agnostic DSL. When loading the schema, its commands will be run against the default keyspace for the environment.
|
329
|
+
|
319
330
|
|
320
331
|
### Version / Migration Architecture (`cassie` developers)
|
321
332
|
|
@@ -1,24 +1,26 @@
|
|
1
1
|
module Cassie::Schema
|
2
|
-
class StructureLoader
|
3
|
-
attr_reader :source_path
|
4
2
|
|
3
|
+
# @deprecated Use {Cassie::Schema::SchemaLoader} instead
|
4
|
+
class StructureLoader
|
5
|
+
attr_reader :source_path
|
5
6
|
|
6
|
-
def initialize(opts={})
|
7
|
-
@source_path = opts[:source_path] || default_source_path
|
8
|
-
end
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def initialize(opts={})
|
9
|
+
@source_path = opts[:source_path] || default_source_path
|
10
|
+
end
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
def load
|
13
|
+
args = ["-f", source_path]
|
14
|
+
runner = Cassie::Support::SystemCommand.new("cqlsh", args)
|
15
|
+
|
16
|
+
runner.run
|
17
|
+
raise runner.failure_message unless runner.success?
|
18
|
+
end
|
17
19
|
|
18
|
-
|
20
|
+
protected
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
def default_source_path
|
23
|
+
Cassie::Schema.paths[:schema_file]
|
24
|
+
end
|
22
25
|
end
|
23
|
-
end
|
24
26
|
end
|
@@ -6,7 +6,7 @@ namespace :cassie do
|
|
6
6
|
|
7
7
|
begin
|
8
8
|
loader = Cassie::Schema::SchemaLoader.new
|
9
|
-
puts "-- Loading '#{Cassie.env}'
|
9
|
+
puts "-- Loading '#{Cassie.env}' schema from #{loader.source_path}"
|
10
10
|
loader.load
|
11
11
|
puts " > '#{Cassie.env}' schema is now at version #{Cassie::Schema.version}"
|
12
12
|
puts "-- done"
|
@@ -25,11 +25,6 @@ module Cassie
|
|
25
25
|
display_info
|
26
26
|
end
|
27
27
|
|
28
|
-
# @returns [Boolean] if task was invoked
|
29
|
-
def run_command
|
30
|
-
task && task.invoke
|
31
|
-
end
|
32
|
-
|
33
28
|
# @returns [Rake::Task, nil] nil if task is not defined, otherwise the task object itself
|
34
29
|
def task
|
35
30
|
task_name = "cassie:#{command}"
|
@@ -52,6 +47,11 @@ module Cassie
|
|
52
47
|
|
53
48
|
protected
|
54
49
|
|
50
|
+
# @returns [Boolean] if task was invoked
|
51
|
+
def run_command
|
52
|
+
task && task.invoke
|
53
|
+
end
|
54
|
+
|
55
55
|
def print_documentation
|
56
56
|
docs = <<-EOS
|
57
57
|
Usage:
|
data/lib/cassie/version.rb
CHANGED
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.1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Prothro
|
@@ -269,9 +269,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
269
|
version: '0'
|
270
270
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
271
|
requirements:
|
272
|
-
- - "
|
272
|
+
- - ">="
|
273
273
|
- !ruby/object:Gem::Version
|
274
|
-
version:
|
274
|
+
version: '0'
|
275
275
|
requirements: []
|
276
276
|
rubyforge_project:
|
277
277
|
rubygems_version: 2.5.2
|