From 09d3d351a1a80032c4e9bf185a15ff95819a4da0 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 11 Feb 2015 09:47:21 -0800 Subject: [PATCH] Remove not null constraint on project_id in services. --- app/models/service.rb | 4 ++-- .../20150211174341_allow_null_in_services_project_id.rb | 5 +++++ db/schema.rb | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20150211174341_allow_null_in_services_project_id.rb diff --git a/app/models/service.rb b/app/models/service.rb index 4a0f8dacecf..4c4fe085c22 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -5,12 +5,12 @@ # id :integer not null, primary key # type :string(255) # title :string(255) -# project_id :integer not null +# project_id :integer # created_at :datetime # updated_at :datetime # active :boolean default(FALSE), not null # properties :text -# tempalate :boolean default(FALSE) +# template :boolean default(FALSE) # To add new service you should build a class inherited from Service # and implement a set of methods diff --git a/db/migrate/20150211174341_allow_null_in_services_project_id.rb b/db/migrate/20150211174341_allow_null_in_services_project_id.rb new file mode 100644 index 00000000000..68f02812791 --- /dev/null +++ b/db/migrate/20150211174341_allow_null_in_services_project_id.rb @@ -0,0 +1,5 @@ +class AllowNullInServicesProjectId < ActiveRecord::Migration + def change + change_column :services, :project_id, :integer, null: true + end +end diff --git a/db/schema.rb b/db/schema.rb index d9f954d5c6c..c41a89af618 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150211172122) do +ActiveRecord::Schema.define(version: 20150211174341) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -360,7 +360,7 @@ ActiveRecord::Schema.define(version: 20150211172122) do create_table "services", force: true do |t| t.string "type" t.string "title" - t.integer "project_id", null: false + t.integer "project_id" t.datetime "created_at" t.datetime "updated_at" t.boolean "active", default: false, null: false