PR #482 — schema changes
fk_rails_0e1f2a3b4c comments.task_id → tasks.id ON DELETE CASCADE
fk_rails_1f2a3b4c5d comments.author_id → users.id
fk_rails_2a3b4c5d6e comments.parent_id → comments.id
fk_rails_w1 task_watchers.task_id → tasks.id ON DELETE CASCADE
fk_rails_w2 task_watchers.user_id → users.id
fk_rails_7b8c9d0e1f tasks.assignee_id → users.id ON DELETE SET NULL
fk_rails_8c9d0e1f2a tasks.reporter_id → users.id
fk_rails_9d0e1f2a3b tasks.parent_task_id → tasks.id
fk_rails_6e7f8a9b0c notifications.recipient_id → users.id ON DELETE CASCADE
public.comments Changed: 1 column removed, 1 index removed
comments
changed: 1 column removed, 1 index removed
CHANGED
id bigint NOT NULL primary key default: nextval('public.comments_id_seq'::regclass)
primary key
PK
id
bigint
task_id bigint NOT NULL → tasks(id) on delete cascade fk_rails_0e1f2a3b4c index index_comments_on_task_id (task_id)
foreign key → tasks(id) on delete cascade fk_rails_0e1f2a3b4c
FK
in 1 index index index_comments_on_task_id (task_id)
IX
task_id
bigint
author_id bigint NOT NULL → users(id) fk_rails_1f2a3b4c5d index index_comments_on_author_id (author_id)
foreign key → users(id) fk_rails_1f2a3b4c5d
FK
in 1 index index index_comments_on_author_id (author_id)
IX
author_id
bigint
parent_id bigint → comments(id) fk_rails_2a3b4c5d6e
foreign key → comments(id) fk_rails_2a3b4c5d6e
FK
parent_id
bigint
nullable
?
body text NOT NULL
body
text
edited_at timestamp(6) without time zone
−
edited_at
timestamp(6)
nullable
?
created_at timestamp(6) without time zone NOT NULL
created_at
timestamp(6)
updated_at timestamp(6) without time zone NOT NULL
updated_at
timestamp(6)
INDEXES & CONSTRAINTS
CREATE INDEX ON public.comments USING btree (parent_id)
−
IX
index_comments_on_parent_id
(parent_id)
public.task_watchers
task_watchers
table added
NEW
id bigint NOT NULL primary key
primary key
PK
id
bigint
task_id bigint NOT NULL → tasks(id) on delete cascade fk_rails_w1 unique index index_task_watchers_on_task_id_and_user_id (task_id, user_id)
foreign key → tasks(id) on delete cascade fk_rails_w1
FK
in 1 index unique index index_task_watchers_on_task_id_and_user_id (task_id, user_id)
IX
task_id
bigint
user_id bigint NOT NULL → users(id) fk_rails_w2 unique index index_task_watchers_on_task_id_and_user_id (task_id, user_id)
foreign key → users(id) fk_rails_w2
FK
in 1 index unique index index_task_watchers_on_task_id_and_user_id (task_id, user_id)
IX
user_id
bigint
created_at timestamp(6) without time zone NOT NULL
created_at
timestamp(6)
public.tasks Changed: 1 column added, 1 column changed
tasks
changed: 1 column added, 1 column changed
CHANGED
2 relations to hidden tables
↗2
id bigint NOT NULL primary key default: nextval('public.tasks_id_seq'::regclass)
primary key
PK
id
bigint
project_id bigint NOT NULL → projects(id) on delete cascade fk_rails_6a7b8c9d0e index index_tasks_on_project_id_and_position (project_id, position)
foreign key → projects(id) on delete cascade fk_rails_6a7b8c9d0e
FK
in 1 index index index_tasks_on_project_id_and_position (project_id, position)
IX
project_id
bigint
assignee_id bigint → users(id) on delete set null fk_rails_7b8c9d0e1f index index_tasks_on_assignee_id (assignee_id)
foreign key → users(id) on delete set null fk_rails_7b8c9d0e1f
FK
in 1 index index index_tasks_on_assignee_id (assignee_id)
IX
assignee_id
bigint
nullable
?
reporter_id bigint NOT NULL → users(id) fk_rails_8c9d0e1f2a
foreign key → users(id) fk_rails_8c9d0e1f2a
FK
reporter_id
bigint
parent_task_id bigint → tasks(id) fk_rails_9d0e1f2a3b
foreign key → tasks(id) fk_rails_9d0e1f2a3b
FK
parent_task_id
bigint
nullable
?
title character varying NOT NULL
title
varchar
body text
body
text
nullable
?
status public.task_status NOT NULL default: 'todo'::public.task_status
status
task_status
priority smallint NOT NULL default: 0 type: integer → smallint
~
priority
int
→
smallint
estimate_minutes integer
+
estimate_minutes
int
nullable
?
due_on date
due_on
date
nullable
?
completed_at timestamp(6) without time zone
completed_at
timestamp(6)
nullable
?
position integer Manual sort order within a project. index index_tasks_on_project_id_and_position (project_id, position)
in 1 index index index_tasks_on_project_id_and_position (project_id, position)
IX
position
int
nullable
?
created_at timestamp(6) without time zone NOT NULL
created_at
timestamp(6)
updated_at timestamp(6) without time zone NOT NULL
updated_at
timestamp(6)
public.users Changed: 2 columns added, 1 column changed
users
changed: 2 columns added, 1 column changed
CHANGED
4 relations to hidden tables
↗4
id bigint NOT NULL primary key default: nextval('public.users_id_seq'::regclass)
primary key
PK
id
bigint
email public.citext NOT NULL unique index index_users_on_email (email)
unique unique index index_users_on_email (email)
UQ
email
citext
name character varying NOT NULL nullable: NULL → NOT NULL
~
name
varchar
encrypted_password character varying NOT NULL default: ''::character varying
encrypted_password
varchar
reset_password_token character varying unique index index_users_on_reset_password_token (reset_password_token)
unique unique index index_users_on_reset_password_token (reset_password_token)
UQ
reset_password_token
varchar
nullable
?
reset_password_sent_at timestamp(6) without time zone
reset_password_sent_at
timestamp(6)
nullable
?
last_sign_in_at timestamp(6) without time zone
last_sign_in_at
timestamp(6)
nullable
?
time_zone character varying NOT NULL default: 'UTC'::character varying
time_zone
varchar
locale character varying(10) NOT NULL default: 'en'::character varying
+
locale
varchar(10)
avatar_url text
+
avatar_url
text
nullable
?
created_at timestamp(6) without time zone NOT NULL
created_at
timestamp(6)
updated_at timestamp(6) without time zone NOT NULL
updated_at
timestamp(6)
public.notifications
notifications
table removed
DROPPED
id bigint NOT NULL primary key default: nextval('public.notifications_id_seq'::regclass)
primary key
PK
id
bigint
recipient_id bigint NOT NULL → users(id) on delete cascade fk_rails_6e7f8a9b0c index index_notifications_on_recipient_id_unread (recipient_id) where (read_at IS NULL)
foreign key → users(id) on delete cascade fk_rails_6e7f8a9b0c
FK
in 1 index index index_notifications_on_recipient_id_unread (recipient_id) where (read_at IS NULL)
IX
recipient_id
bigint
notifiable_type character varying NOT NULL index index_notifications_on_notifiable (notifiable_type, notifiable_id)
in 1 index index index_notifications_on_notifiable (notifiable_type, notifiable_id)
IX
notifiable_type
varchar
notifiable_id bigint NOT NULL index index_notifications_on_notifiable (notifiable_type, notifiable_id)
in 1 index index index_notifications_on_notifiable (notifiable_type, notifiable_id)
IX
notifiable_id
bigint
kind character varying NOT NULL
kind
varchar
read_at timestamp(6) without time zone
read_at
timestamp(6)
nullable
?
created_at timestamp(6) without time zone NOT NULL
created_at
timestamp(6)