Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Adding a rake task for updating your fauna schema #25

Merged
merged 2 commits into from

2 participants

@stevej

No description provided.

@evan
Owner

Nice. Can you update the README to reflect the handy task?

@stevej

added!

@evan evan merged commit cce5829 into faunadb:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 1 deletion.
  1. +1 −1  README.md
  2. +3 −0  lib/fauna.rb
  3. +8 −0 lib/tasks/fauna.rake
View
2  README.md
@@ -170,7 +170,7 @@ Fauna.schema do
end
```
-Install your schema on the server via a Rake task or the Rails
+Install your schema on the server via the `fauna:migrate` Rake task or the Rails
console:
```ruby
View
3  lib/fauna.rb
@@ -7,6 +7,9 @@
require "active_support/core_ext/module/delegation"
require "active_support/core_ext/hash/slice"
+# FIXME: Dir globbing is broken in 1.9.3 https://bugs.ruby-lang.org/issues/6977
+load "tasks/fauna.rake" if defined?(Rake)
+
module Fauna
class Invalid < RuntimeError
end
View
8 lib/tasks/fauna.rake
@@ -0,0 +1,8 @@
+namespace :fauna do
+ desc "Migrate your fauna database to the latest version"
+ task :migrate => :environment do
+ Fauna::Client.context(Fauna.connection) do
+ Fauna.migrate_schema!
+ end
+ end
+end
Something went wrong with that request. Please try again.