mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: add seed-list table
This commit is contained in:
parent
dc4dda7e17
commit
83b7fb83ab
6 changed files with 52 additions and 0 deletions
|
@ -9,6 +9,7 @@ import {
|
|||
UserAuth,
|
||||
GameAchievement,
|
||||
UserSubscription,
|
||||
SeedList,
|
||||
} from "@main/entity";
|
||||
|
||||
import { databasePath } from "./constants";
|
||||
|
@ -25,6 +26,7 @@ export const dataSource = new DataSource({
|
|||
DownloadSource,
|
||||
DownloadQueue,
|
||||
GameAchievement,
|
||||
SeedList,
|
||||
],
|
||||
synchronize: false,
|
||||
database: databasePath,
|
||||
|
|
|
@ -8,3 +8,4 @@ export * from "./game.entity";
|
|||
export * from "./game-achievements.entity";
|
||||
export * from "./download-source.entity";
|
||||
export * from "./download-queue.entity";
|
||||
export * from "./seed-list.entity";
|
||||
|
|
25
src/main/entity/seed-list.entity.ts
Normal file
25
src/main/entity/seed-list.entity.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Column,
|
||||
} from "typeorm";
|
||||
|
||||
@Entity("seed_list")
|
||||
export class SeedList {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column("text")
|
||||
downloadUri: string;
|
||||
|
||||
@Column("boolean", { default: false })
|
||||
shouldSeed: boolean;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
}
|
|
@ -13,6 +13,7 @@ import { AddBackgroundImageUrl } from "./migrations/20241016100249_add_backgroun
|
|||
import { AddWinePrefixToGame } from "./migrations/20241019081648_add_wine_prefix_to_game";
|
||||
import { AddStartMinimizedColumn } from "./migrations/20241030171454_add_start_minimized_column";
|
||||
import { AddSeedAfterDownloadCompletesColumn } from "./migrations/20241101012727_add_seed_after_download_completes_column";
|
||||
import { AddSeedListTable } from "./migrations/20241103231555_add_seed_list_table";
|
||||
export type HydraMigration = Knex.Migration & { name: string };
|
||||
|
||||
class MigrationSource implements Knex.MigrationSource<HydraMigration> {
|
||||
|
@ -30,6 +31,7 @@ class MigrationSource implements Knex.MigrationSource<HydraMigration> {
|
|||
AddWinePrefixToGame,
|
||||
AddStartMinimizedColumn,
|
||||
AddSeedAfterDownloadCompletesColumn,
|
||||
AddSeedListTable,
|
||||
]);
|
||||
}
|
||||
getMigrationName(migration: HydraMigration): string {
|
||||
|
|
19
src/main/migrations/20241103231555_add_seed_list_table.ts
Normal file
19
src/main/migrations/20241103231555_add_seed_list_table.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import type { HydraMigration } from "@main/knex-client";
|
||||
import type { Knex } from "knex";
|
||||
|
||||
export const AddSeedListTable: HydraMigration = {
|
||||
name: "AddSeedListTable",
|
||||
up: (knex: Knex) => {
|
||||
return knex.schema.createTable("seed_list", async (table) => {
|
||||
table.increments("id").primary();
|
||||
table.text("downloadUri").notNullable();
|
||||
table.boolean("shouldSeed").defaultTo(false);
|
||||
table.datetime("createdAt").notNullable().defaultTo(knex.fn.now());
|
||||
table.datetime("updatedAt").notNullable().defaultTo(knex.fn.now());
|
||||
});
|
||||
},
|
||||
|
||||
down: async (knex: Knex) => {
|
||||
return knex.schema.dropTable("seed_list");
|
||||
},
|
||||
};
|
|
@ -9,6 +9,7 @@ import {
|
|||
UserAuth,
|
||||
GameAchievement,
|
||||
UserSubscription,
|
||||
SeedList,
|
||||
} from "@main/entity";
|
||||
|
||||
export const gameRepository = dataSource.getRepository(Game);
|
||||
|
@ -27,6 +28,8 @@ export const downloadQueueRepository = dataSource.getRepository(DownloadQueue);
|
|||
|
||||
export const userAuthRepository = dataSource.getRepository(UserAuth);
|
||||
|
||||
export const seedListRepository = dataSource.getRepository(SeedList);
|
||||
|
||||
export const userSubscriptionRepository =
|
||||
dataSource.getRepository(UserSubscription);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue