Skip to content

Commit

Permalink
Add enabled column to notifiers table
Browse files Browse the repository at this point in the history
  • Loading branch information
sr committed Mar 29, 2009
1 parent 143b75b commit 40165ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions lib/integrity/migrations.rb
Expand Up @@ -136,5 +136,15 @@ class ::Integrity::Build
end end
end end
end end

migration 3, :add_enabled_column do
up do
modify_table(:integrity_notifiers) { add_column :enabled, Boolean }
end

down do
modify_table(:integrity_notifiers) { remove_column :enabled }
end
end
end end
end end
1 change: 1 addition & 0 deletions lib/integrity/notifier.rb
Expand Up @@ -6,6 +6,7 @@ class Notifier


property :id, Integer, :serial => true property :id, Integer, :serial => true
property :name, String, :nullable => false property :name, String, :nullable => false
property :enabled, Boolean, :nullable => false, :default => false
property :config, Yaml, :nullable => false, :lazy => false property :config, Yaml, :nullable => false, :lazy => false


belongs_to :project, :class_name => "Integrity::Project" belongs_to :project, :class_name => "Integrity::Project"
Expand Down
4 changes: 2 additions & 2 deletions test/unit/migrations_test.rb
Expand Up @@ -30,7 +30,7 @@ def load_initial_migration_fixture
test "upgrading a pre migration database" do test "upgrading a pre migration database" do
capture_stdout { Integrity.migrate_db } capture_stdout { Integrity.migrate_db }


current_migrations.should == ["initial", "add_commits"] current_migrations.should == ["initial", "add_commits", "add_enabled_column"]
assert table_exists?("integrity_projects") assert table_exists?("integrity_projects")
assert table_exists?("integrity_builds") assert table_exists?("integrity_builds")
assert table_exists?("integrity_notifiers") assert table_exists?("integrity_notifiers")
Expand All @@ -41,7 +41,7 @@ def load_initial_migration_fixture
load_initial_migration_fixture load_initial_migration_fixture


capture_stdout { Integrity.migrate_db } capture_stdout { Integrity.migrate_db }
current_migrations.should == ["initial", "add_commits"] current_migrations.should == ["initial", "add_commits", "add_enabled_column"]


sinatra = Project.first(:name => "Sinatra") sinatra = Project.first(:name => "Sinatra")
sinatra.should have(1).commits sinatra.should have(1).commits
Expand Down

0 comments on commit 40165ec

Please sign in to comment.