Commit 14433b34 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

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 ...@@ -7,8 +7,8 @@ class AddDeployments < ActiveRecord::Migration
def change def change
create_table :deployments, force: true do |t| create_table :deployments, force: true do |t|
t.integer :iid, null: false t.integer :iid, null: false
t.integer :project_id, null: false t.integer :project_id
t.integer :environment_id, null: false t.integer :environment_id
t.string :ref, null: false t.string :ref, null: false
t.boolean :tag, null: false t.boolean :tag, null: false
t.string :sha, null: false t.string :sha, null: false
......
...@@ -385,8 +385,8 @@ ...@@ -385,8 +385,8 @@
create_table "deployments", force: :cascade do |t| create_table "deployments", force: :cascade do |t|
t.integer "iid", null: false t.integer "iid", null: false
t.integer "project_id", null: false t.integer "project_id"
t.integer "environment_id", null: false t.integer "environment_id"
t.string "ref", null: false t.string "ref", null: false
t.boolean "tag", null: false t.boolean "tag", null: false
t.string "sha", null: false t.string "sha", null: false
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
add_index "emails", ["user_id"], name: "index_emails_on_user_id", using: :btree add_index "emails", ["user_id"], name: "index_emails_on_user_id", using: :btree
create_table "environments", force: :cascade do |t| create_table "environments", force: :cascade do |t|
t.integer "project_id", null: false t.integer "project_id"
t.string "name", null: false t.string "name", null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
let(:params) do let(:params) do
{ environment: 'production', { environment: 'production',
ref: 'master', ref: 'master',
tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142', sha: '97de212e80737a608d939f648d959671fb0a0142',
} }
end end
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
let(:params) do let(:params) do
{ environment: 'name with spaces', { environment: 'name with spaces',
ref: 'master', ref: 'master',
tag: false,
sha: '97de212e80737a608d939f648d959671fb0a0142', sha: '97de212e80737a608d939f648d959671fb0a0142',
} }
end 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