Dnd remove default column value (#4337)
* Revert "Revert dnd (#4294)"
This reverts commit 9fac8f476e
.
* removed default value of new column for DND
* Used a column function, and collases for default value
* fix bad merge
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
This commit is contained in:
parent
8927592c57
commit
78ac6924e8
3 changed files with 19 additions and 5 deletions
|
@ -13,9 +13,24 @@ import (
|
|||
|
||||
const categorySortOrderGap = 10
|
||||
|
||||
func (s *SQLStore) categoryFields() []string {
|
||||
return []string{
|
||||
"id",
|
||||
"name",
|
||||
"user_id",
|
||||
"team_id",
|
||||
"create_at",
|
||||
"update_at",
|
||||
"delete_at",
|
||||
"collapsed",
|
||||
"COALESCE(sort_order, 0)",
|
||||
"type",
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SQLStore) getCategory(db sq.BaseRunner, id string) (*model.Category, error) {
|
||||
query := s.getQueryBuilder(db).
|
||||
Select("id", "name", "user_id", "team_id", "create_at", "update_at", "delete_at", "collapsed", "sort_order", "type").
|
||||
Select(s.categoryFields()...).
|
||||
From(s.tablePrefix + "categories").
|
||||
Where(sq.Eq{"id": id})
|
||||
|
||||
|
@ -149,7 +164,7 @@ func (s *SQLStore) deleteCategory(db sq.BaseRunner, categoryID, userID, teamID s
|
|||
|
||||
func (s *SQLStore) getUserCategories(db sq.BaseRunner, userID, teamID string) ([]model.Category, error) {
|
||||
query := s.getQueryBuilder(db).
|
||||
Select("id", "name", "user_id", "team_id", "create_at", "update_at", "delete_at", "collapsed", "sort_order", "type").
|
||||
Select(s.categoryFields()...).
|
||||
From(s.tablePrefix+"categories").
|
||||
Where(sq.Eq{
|
||||
"user_id": userID,
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
{{- /* addColumnIfNeeded tableName columnName datatype constraint */ -}}
|
||||
{{ addColumnIfNeeded "categories" "sort_order" "BIGINT" "DEFAULT 0"}}
|
||||
{{ addColumnIfNeeded "categories" "sort_order" "BIGINT" ""}}
|
|
@ -1,3 +1,2 @@
|
|||
{{- /* addColumnIfNeeded tableName columnName datatype constraint */ -}}
|
||||
{{ addColumnIfNeeded "category_boards" "sort_order" "BIGINT" "DEFAULT 0"}}
|
||||
|
||||
{{ addColumnIfNeeded "category_boards" "sort_order" "BIGINT" ""}}
|
Loading…
Reference in a new issue