Update DB local_user.theme type to text (#3266)
authorScott <97430840+scme0@users.noreply.github.com>
Mon, 26 Jun 2023 08:53:04 +0000 (18:23 +0930)
committerGitHub <noreply@github.com>
Mon, 26 Jun 2023 08:53:04 +0000 (10:53 +0200)
* Update local_user.theme type to text

* fix default value

* Undo auto generate changes

crates/db_schema/src/schema.rs
migrations/2023-06-22-101245_increase_user_theme_column_size/down.sql [new file with mode: 0644]
migrations/2023-06-22-101245_increase_user_theme_column_size/up.sql [new file with mode: 0644]

index 6714913f468b357379ab6c10ea78b811e7235113..aef6fbe5dff3725450e2e1925a9f17fc3e0cdbc7 100644 (file)
@@ -381,8 +381,7 @@ diesel::table! {
         password_encrypted -> Text,
         email -> Nullable<Text>,
         show_nsfw -> Bool,
-        #[max_length = 20]
-        theme -> Varchar,
+        theme -> Text,
         default_sort_type -> SortTypeEnum,
         default_listing_type -> ListingTypeEnum,
         #[max_length = 20]
diff --git a/migrations/2023-06-22-101245_increase_user_theme_column_size/down.sql b/migrations/2023-06-22-101245_increase_user_theme_column_size/down.sql
new file mode 100644 (file)
index 0000000..0731e06
--- /dev/null
@@ -0,0 +1,2 @@
+alter table only local_user alter column theme TYPE character varying(20);
+alter table only local_user alter column theme set default 'browser'::character varying;
\ No newline at end of file
diff --git a/migrations/2023-06-22-101245_increase_user_theme_column_size/up.sql b/migrations/2023-06-22-101245_increase_user_theme_column_size/up.sql
new file mode 100644 (file)
index 0000000..cbab256
--- /dev/null
@@ -0,0 +1,2 @@
+alter table only local_user alter column theme type text;
+alter table only local_user alter column theme set default 'browser'::text;