Ensure reports have an issue id and a user id
This commit is contained in:
parent
5e7abf67fb
commit
3e5a4a14df
3 changed files with 6 additions and 4 deletions
|
@ -25,6 +25,8 @@ class Report < ActiveRecord::Base
|
||||||
belongs_to :issue, :counter_cache => true
|
belongs_to :issue, :counter_cache => true
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
validates :issue, :presence => true
|
||||||
|
validates :user, :presence => true
|
||||||
validates :details, :presence => true
|
validates :details, :presence => true
|
||||||
validates :category, :presence => true
|
validates :category, :presence => true
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ class CreateIssuesAndReports < ActiveRecord::Migration[5.0]
|
||||||
add_index :issues, :updated_by
|
add_index :issues, :updated_by
|
||||||
|
|
||||||
create_table :reports do |t|
|
create_table :reports do |t|
|
||||||
t.integer :issue_id
|
t.integer :issue_id, :null => false
|
||||||
t.integer :user_id
|
t.integer :user_id, :null => false
|
||||||
t.text :details, :null => false
|
t.text :details, :null => false
|
||||||
t.string :category, :null => false
|
t.string :category, :null => false
|
||||||
t.timestamps :null => false
|
t.timestamps :null => false
|
||||||
|
|
|
@ -1064,8 +1064,8 @@ CREATE TABLE relations (
|
||||||
|
|
||||||
CREATE TABLE reports (
|
CREATE TABLE reports (
|
||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
issue_id integer,
|
issue_id integer NOT NULL,
|
||||||
user_id integer,
|
user_id integer NOT NULL,
|
||||||
details text NOT NULL,
|
details text NOT NULL,
|
||||||
category character varying NOT NULL,
|
category character varying NOT NULL,
|
||||||
created_at timestamp without time zone NOT NULL,
|
created_at timestamp without time zone NOT NULL,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue