forked from makersacademy/chitter-challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
43 lines (35 loc) · 1.14 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'data_mapper'
require './app/server'
begin
require 'rubocop/rake_task'
require 'rspec/core/rake_task'
RuboCop::RakeTask.new(:cop)
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
end
task default: [:cop, :spec]
task :env do
puts Sinatra::Application.environment
end
namespace :db do
desc "Non destructive upgrade"
task :auto_upgrade do
# auto_upgrade makes non-destructive changes.
# If your tables don't exist, they will be created
# but if they do and you changed your schema
# (e.g. changed the type of one of the properties)
# they will not be upgraded because that would lead to data loss.
DataMapper.auto_upgrade!
puts 'Auto-upgrade complete (no data loss)'
end
desc "Destructive upgrade"
task :auto_migrate do
# To force the creation of all tables as they are
# described in your models, even if this
# may lead to data loss, use auto_migrate:
DataMapper.auto_migrate!
puts 'Auto-migrate complete (data could have been lost)'
end
# Finally, don't forget that before you do any of that stuff,
# you need to create a database first.
end