Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: add theme_preference column to users table#11069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 8 commits intomainfromuser-theme-preference
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletioncoderd/database/dump.sql
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
ALTER TABLE users DROP COLUMN "theme_preference";
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
ALTER TABLE users ADD COLUMN "theme_preference" text NOT NULL DEFAULT '';

COMMENT ON COLUMN "users"."theme_preference" IS '"" can be interpreted as "the user does not care", falling back to the default theme';
8 changes: 4 additions & 4 deletionscoderd/database/migrations/create_migration.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

# Usage:
# ./create_migration name of migration
# ./create_migration "name of migration"
# ./create_migration name_of_migration
# ./create_migration.sh name of migration
# ./create_migration.sh "name of migration"
# ./create_migration.sh name_of_migration

set -euo pipefail

Expand All@@ -27,7 +27,7 @@ CREATE TYPE new_logintype AS ENUM (
ALTER TABLE users
ALTER COLUMN login_type DROP DEFAULT, -- if the column has a default, it must be dropped first
ALTER COLUMN login_type TYPE new_logintype USING (login_type::text::new_logintype), -- converts the old enumuntil the new enum using text as an intermediary
ALTER COLUMN login_type TYPE new_logintype USING (login_type::text::new_logintype), -- converts the old enuminto the new enum using text as an intermediary
ALTER COLUMN login_type SET DEFAULT 'password'::new_logintype; -- re-add the default using the new enum
DROP TYPE login_type;
Expand Down
25 changes: 13 additions & 12 deletionscoderd/database/modelmethods.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -332,18 +332,19 @@ func ConvertUserRows(rows []GetUsersRow) []User {
users:=make([]User,len(rows))
fori,r:=rangerows {
users[i]=User{
ID:r.ID,
Email:r.Email,
Username:r.Username,
HashedPassword:r.HashedPassword,
CreatedAt:r.CreatedAt,
UpdatedAt:r.UpdatedAt,
Status:r.Status,
RBACRoles:r.RBACRoles,
LoginType:r.LoginType,
AvatarURL:r.AvatarURL,
Deleted:r.Deleted,
LastSeenAt:r.LastSeenAt,
ID:r.ID,
Email:r.Email,
Username:r.Username,
HashedPassword:r.HashedPassword,
CreatedAt:r.CreatedAt,
UpdatedAt:r.UpdatedAt,
Status:r.Status,
RBACRoles:r.RBACRoles,
LoginType:r.LoginType,
AvatarURL:r.AvatarURL,
Deleted:r.Deleted,
LastSeenAt:r.LastSeenAt,
ThemePreference:r.ThemePreference,
}
}

Expand Down
1 change: 1 addition & 0 deletionscoderd/database/modelqueries.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -316,6 +316,7 @@ func (q *sqlQuerier) GetAuthorizedUsers(ctx context.Context, arg GetUsersParams,
&i.Deleted,
&i.LastSeenAt,
&i.QuietHoursSchedule,
&i.ThemePreference,
&i.Count,
); err != nil {
return nil, err
Expand Down
2 changes: 2 additions & 0 deletionscoderd/database/models.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

37 changes: 25 additions & 12 deletionscoderd/database/queries.sql.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

Loading

[8]ページ先頭

©2009-2025 Movatter.jp