Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make internal info mandatory for framework.

 - Because ccng already assumes that its not nil.

Change-Id: I07a18335a0fdf162d54dcd81174bc8417bd9c9f8
  • Loading branch information...
commit 06ad4883aec0a9878ad38fdad38b25d71ac5f03c 1 parent ac562d0
@kowshik kowshik authored
View
17 db/migrations/20130122234841_require_internal_info_for_frameworks.rb
@@ -0,0 +1,17 @@
+# Copyright (c) 2009-2012 VMware, Inc.
+
+Sequel.migration do
+ change do
+ alter_table :frameworks do
+ set_column_not_null :internal_info
+
+ # Redo all constraints because SQLite has a bug
+ # when adding new constraint to the table
+ if @db.kind_of?(Sequel::SQLite::Database)
+ set_column_not_null :name
+ add_unique_constraint :name
+ set_column_not_null :description
+ end
+ end
+ end
+end
View
1  lib/cloud_controller/api/framework.rb
@@ -10,6 +10,7 @@ module VCAP::CloudController
define_attributes do
attribute :name, String
attribute :description, String
+ attribute :internal_info, Hash
to_many :apps
end
View
5 lib/cloud_controller/models/framework.rb
@@ -7,8 +7,8 @@ class Framework < Sequel::Model
one_to_many :apps
default_order_by :name
- export_attributes :name, :description
- import_attributes :name, :description
+ export_attributes :name, :description, :internal_info
+ import_attributes :name, :description, :internal_info
strip_attributes :name
@@ -17,6 +17,7 @@ class Framework < Sequel::Model
def validate
validates_presence :name
validates_presence :description
+ validates_presence :internal_info
validates_unique :name
end
View
2  spec/api/framework_spec.rb
@@ -9,7 +9,7 @@ module VCAP::CloudController
:path => "/v2/frameworks",
:model => Models::Framework,
:basic_attributes => [:name, :description],
- :required_attributes => [:name, :description],
+ :required_attributes => [:name, :description, :internal_info],
:unique_attributes => :name,
:one_to_many_collection_ids => {
:apps => lambda { |framework| Models::App.make }
View
2  spec/models/framework_spec.rb
@@ -5,7 +5,7 @@
module VCAP::CloudController
describe VCAP::CloudController::Models::Framework do
it_behaves_like "a CloudController model", {
- :required_attributes => [:name, :description],
+ :required_attributes => [:name, :description, :internal_info],
:unique_attributes => :name,
:stripped_string_attributes => :name,
:one_to_zero_or_more => {
Please sign in to comment.
Something went wrong with that request. Please try again.