diff options
author | 2024-11-25 13:48:59 +0000 | |
---|---|---|
committer | 2024-11-25 14:48:59 +0100 | |
commit | cac9d65029e972af9440ff79a2617d5c524a9d64 (patch) | |
tree | 87353498b2d6bb29679cd4af8744d5b3f7cd3423 /internal/gtsmodel/common.go | |
parent | [chore]: Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#3564) (diff) | |
download | gotosocial-cac9d65029e972af9440ff79a2617d5c524a9d64.tar.xz |
[performance] convert enum strings to ints (#3558)
* convert statuses.visibility and notifications.notification_type columns from type string -> int for performance / space savings
* fix test trying to compare string to int
* fix instance count query using string literal instead of gtsmodel const type
* ensure a default value is always set
* also migrate the account settings and sin bin status tables
* initialize maps outside loops and place into singular enum mapping creation func
* use int16 for enum types
* update sinbinstatus creation to be from a snapshot at initial creation
* add snapshot of poll type at creation time
Diffstat (limited to 'internal/gtsmodel/common.go')
-rw-r--r-- | internal/gtsmodel/common.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/gtsmodel/common.go b/internal/gtsmodel/common.go new file mode 100644 index 000000000..e740bbb81 --- /dev/null +++ b/internal/gtsmodel/common.go @@ -0,0 +1,24 @@ +// GoToSocial +// Copyright (C) GoToSocial Authors admin@gotosocial.org +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +package gtsmodel + +// enumType is the type we (at least, should) use +// for database enum types. it is the largest size +// supported by a PostgreSQL SMALLINT, since an +// SQLite SMALLINT is actually variable in size. +type enumType int16 |