From 468af132e89a8cb80392b7d6e12f1e53b849c0c1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 25 May 2018 18:11:46 +0200 Subject: [PATCH] feat(db): Add migration & fields to indicate a thread is closed --- migrations/2018-05-25-160648_add_closed_column/down.sql | 1 + migrations/2018-05-25-160648_add_closed_column/up.sql | 1 + src/models.rs | 1 + src/schema.rs | 1 + 4 files changed, 4 insertions(+) create mode 100644 migrations/2018-05-25-160648_add_closed_column/down.sql create mode 100644 migrations/2018-05-25-160648_add_closed_column/up.sql diff --git a/migrations/2018-05-25-160648_add_closed_column/down.sql b/migrations/2018-05-25-160648_add_closed_column/down.sql new file mode 100644 index 000000000..fb2a98c0a --- /dev/null +++ b/migrations/2018-05-25-160648_add_closed_column/down.sql @@ -0,0 +1 @@ +ALTER TABLE threads DROP COLUMN closed; diff --git a/migrations/2018-05-25-160648_add_closed_column/up.sql b/migrations/2018-05-25-160648_add_closed_column/up.sql new file mode 100644 index 000000000..d7d4c44da --- /dev/null +++ b/migrations/2018-05-25-160648_add_closed_column/up.sql @@ -0,0 +1 @@ +ALTER TABLE threads ADD COLUMN closed BOOLEAN NOT NULL DEFAULT false; diff --git a/src/models.rs b/src/models.rs index 3ad4a5ed9..006596fd8 100644 --- a/src/models.rs +++ b/src/models.rs @@ -39,6 +39,7 @@ pub struct Thread { pub posted: DateTime, pub sticky: bool, pub user_id: i32, + pub closed: bool, } #[derive(Identifiable, Queryable, Serialize, Associations)] diff --git a/src/schema.rs b/src/schema.rs index a824c658c..f163f4b1e 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -33,6 +33,7 @@ table! { posted -> Timestamptz, sticky -> Bool, user_id -> Int4, + closed -> Bool, } }