mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-14 20:22:10 +00:00
feat: adding background image migration
This commit is contained in:
parent
67109ff51a
commit
a498f9dd80
4 changed files with 23 additions and 0 deletions
|
@ -22,6 +22,9 @@ export class UserAuth {
|
|||
@Column("text", { nullable: true })
|
||||
profileImageUrl: string | null;
|
||||
|
||||
@Column("text", { nullable: true })
|
||||
backgroundImageUrl: string | null;
|
||||
|
||||
@Column("text", { default: "" })
|
||||
accessToken: string;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ const getMe = async (
|
|||
id: 1,
|
||||
displayName: me.displayName,
|
||||
profileImageUrl: me.profileImageUrl,
|
||||
backgroundImageUrl: me.backgroundImageUrl,
|
||||
userId: me.id,
|
||||
},
|
||||
["id"]
|
||||
|
|
|
@ -9,6 +9,7 @@ import { FixMissingColumns } from "./migrations/20240918001920_FixMissingColumns
|
|||
import { CreateGameAchievement } from "./migrations/20240919030940_create_game_achievement";
|
||||
import { AddAchievementNotificationPreference } from "./migrations/20241013012900_add_achievement_notification_preference";
|
||||
import { CreateUserSubscription } from "./migrations/20241015235142_create_user_subscription";
|
||||
import { AddBackgroundImageUrl } from "./migrations/20241016100249_add_background_image_url";
|
||||
|
||||
export type HydraMigration = Knex.Migration & { name: string };
|
||||
|
||||
|
@ -23,6 +24,7 @@ class MigrationSource implements Knex.MigrationSource<HydraMigration> {
|
|||
CreateGameAchievement,
|
||||
AddAchievementNotificationPreference,
|
||||
CreateUserSubscription,
|
||||
AddBackgroundImageUrl,
|
||||
]);
|
||||
}
|
||||
getMigrationName(migration: HydraMigration): string {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import type { HydraMigration } from "@main/knex-client";
|
||||
import type { Knex } from "knex";
|
||||
|
||||
export const AddBackgroundImageUrl: HydraMigration = {
|
||||
name: "AddBackgroundImageUrl",
|
||||
up: (knex: Knex) => {
|
||||
return knex.schema.alterTable("user_auth", (table) => {
|
||||
return table.text("backgroundImageUrl").nullable();
|
||||
});
|
||||
},
|
||||
|
||||
down: async (knex: Knex) => {
|
||||
return knex.schema.alterTable("user_auth", (table) => {
|
||||
return table.dropColumn("backgroundImageUrl");
|
||||
});
|
||||
},
|
||||
};
|
Loading…
Reference in a new issue