feat: add onboarding with oldmarr import (#1606)

This commit is contained in:
Meier Lukas
2024-12-15 15:40:26 +01:00
committed by GitHub
parent 82ec77d2da
commit 6de74d9525
108 changed files with 6045 additions and 312 deletions

View File

@@ -0,0 +1,6 @@
CREATE TABLE `onboarding` (
`id` varchar(64) NOT NULL,
`step` varchar(64) NOT NULL,
`previous_step` varchar(64),
CONSTRAINT `onboarding_id` PRIMARY KEY(`id`)
);

File diff suppressed because it is too large Load Diff

View File

@@ -120,6 +120,13 @@
"when": 1732212709518,
"tag": "0016_change_all_to_snake_case",
"breakpoints": true
},
{
"idx": 17,
"version": "5",
"when": 1733777544067,
"tag": "0017_tired_penance",
"breakpoints": true
}
]
}

View File

@@ -7,10 +7,11 @@ import { defaultServerSettings, defaultServerSettingsKeys } from "@homarr/server
import { createId, eq } from "..";
import type { Database } from "..";
import { groups } from "../schema/mysql";
import { serverSettings } from "../schema/sqlite";
import { onboarding, serverSettings } from "../schema/sqlite";
export const seedDataAsync = async (db: Database) => {
await seedEveryoneGroupAsync(db);
await seedOnboardingAsync(db);
await seedServerSettingsAsync(db);
};
@@ -31,6 +32,21 @@ const seedEveryoneGroupAsync = async (db: Database) => {
console.log("Created group 'everyone' through seed");
};
const seedOnboardingAsync = async (db: Database) => {
const existing = await db.query.onboarding.findFirst();
if (existing) {
console.log("Skipping seeding of onboarding as it already exists");
return;
}
await db.insert(onboarding).values({
id: createId(),
step: "start",
});
console.log("Created onboarding step through seed");
};
const seedServerSettingsAsync = async (db: Database) => {
const serverSettingsData = await db.query.serverSettings.findMany();

View File

@@ -0,0 +1,5 @@
CREATE TABLE `onboarding` (
`id` text PRIMARY KEY NOT NULL,
`step` text NOT NULL,
`previous_step` text
);

File diff suppressed because it is too large Load Diff

View File

@@ -120,6 +120,13 @@
"when": 1732210918783,
"tag": "0016_change_all_to_snake_case",
"breakpoints": true
},
{
"idx": 17,
"version": "6",
"when": 1733777395703,
"tag": "0017_small_rumiko_fujikawa",
"breakpoints": true
}
]
}

View File

@@ -25,6 +25,7 @@ import type {
IntegrationKind,
IntegrationPermission,
IntegrationSecretKind,
OnboardingStep,
SearchEngineType,
SectionKind,
SupportedAuthProvider,
@@ -395,6 +396,12 @@ export const searchEngines = mysqlTable("search_engine", {
integrationId: varchar({ length: 64 }).references(() => integrations.id, { onDelete: "cascade" }),
});
export const onboarding = mysqlTable("onboarding", {
id: varchar({ length: 64 }).notNull().primaryKey(),
step: varchar({ length: 64 }).$type<OnboardingStep>().notNull(),
previousStep: varchar({ length: 64 }).$type<OnboardingStep>(),
});
export const accountRelations = relations(accounts, ({ one }) => ({
user: one(users, {
fields: [accounts.userId],

View File

@@ -16,6 +16,7 @@ import type {
IntegrationKind,
IntegrationPermission,
IntegrationSecretKind,
OnboardingStep,
SearchEngineType,
SectionKind,
SupportedAuthProvider,
@@ -382,6 +383,12 @@ export const searchEngines = sqliteTable("search_engine", {
integrationId: text().references(() => integrations.id, { onDelete: "cascade" }),
});
export const onboarding = sqliteTable("onboarding", {
id: text().notNull().primaryKey(),
step: text().$type<OnboardingStep>().notNull(),
previousStep: text().$type<OnboardingStep>(),
});
export const accountRelations = relations(accounts, ({ one }) => ({
user: one(users, {
fields: [accounts.userId],