feat: add onboarding with oldmarr import (#1606)
This commit is contained in:
6
packages/db/migrations/mysql/0017_tired_penance.sql
Normal file
6
packages/db/migrations/mysql/0017_tired_penance.sql
Normal 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`)
|
||||
);
|
||||
1663
packages/db/migrations/mysql/meta/0017_snapshot.json
Normal file
1663
packages/db/migrations/mysql/meta/0017_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
CREATE TABLE `onboarding` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`step` text NOT NULL,
|
||||
`previous_step` text
|
||||
);
|
||||
1587
packages/db/migrations/sqlite/meta/0017_snapshot.json
Normal file
1587
packages/db/migrations/sqlite/meta/0017_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user