BigW Consortium Gitlab

Commit 14433b34 by Kamil Trzcinski

Make `project_id` and `environment_id` nullable

This is done to make belongs_to with required to properly validate association. Otherwise `ActiveRecord::StatementInvalid` is raised.
parent eb26755d
......@@ -7,8 +7,8 @@ class AddDeployments < ActiveRecord::Migration
def change
create_table :deployments, force: true do |t|
t.integer :iid, null: false
t.integer :project_id, null: false
t.integer :environment_id, null: false
t.integer :project_id
t.integer :environment_id
t.string :ref, null: false
t.boolean :tag, null: false
t.string :sha, null: false
......
......@@ -385,8 +385,8 @@ ActiveRecord::Schema.define(version: 20160610301627) do
create_table "deployments", force: :cascade do |t|
t.integer "iid", null: false
t.integer "project_id", null: false
t.integer "environment_id", null: false
t.integer "project_id"
t.integer "environment_id"
t.string "ref", null: false
t.boolean "tag", null: false
t.string "sha", null: false
......@@ -413,7 +413,7 @@ ActiveRecord::Schema.define(version: 20160610301627) do
add_index "emails", ["user_id"], name: "index_emails_on_user_id", using: :btree
create_table "environments", force: :cascade do |t|
t.integer "project_id", null: false
t.integer "project_id"
t.string "name", null: false
t.datetime "created_at"
t.datetime "updated_at"
......
......@@ -10,6 +10,7 @@ describe CreateDeploymentService, services: true do
let(:params) do
{ environment: 'production',
ref: 'master',
tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142',
}
end
......@@ -42,6 +43,7 @@ describe CreateDeploymentService, services: true do
let(:params) do
{ environment: 'name with spaces',
ref: 'master',
tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142',
}
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment