Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
4
packages/db/migrations/mysql/0015_unknown_firedrake.sql
Normal file
4
packages/db/migrations/mysql/0015_unknown_firedrake.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE `search_engine` MODIFY COLUMN `url_template` text;--> statement-breakpoint
|
||||
ALTER TABLE `search_engine` ADD `type` varchar(64) DEFAULT 'generic' NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE `search_engine` ADD `integration_id` varchar(64);--> statement-breakpoint
|
||||
ALTER TABLE `search_engine` ADD CONSTRAINT `search_engine_integration_id_integration_id_fk` FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON DELETE cascade ON UPDATE no action;
|
||||
1627
packages/db/migrations/mysql/meta/0015_snapshot.json
Normal file
1627
packages/db/migrations/mysql/meta/0015_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -106,6 +106,13 @@
|
||||
"when": 1729524382483,
|
||||
"tag": "0014_bizarre_red_shift",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 15,
|
||||
"version": "5",
|
||||
"when": 1730653393442,
|
||||
"tag": "0015_unknown_firedrake",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
17
packages/db/migrations/sqlite/0015_superb_psylocke.sql
Normal file
17
packages/db/migrations/sqlite/0015_superb_psylocke.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
||||
CREATE TABLE `__new_search_engine` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`icon_url` text NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`short` text NOT NULL,
|
||||
`description` text,
|
||||
`url_template` text,
|
||||
`type` text DEFAULT 'generic' NOT NULL,
|
||||
`integration_id` text,
|
||||
FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
INSERT INTO `__new_search_engine`("id", "icon_url", "name", "short", "description", "url_template") SELECT "id", "icon_url", "name", "short", "description", "url_template" FROM `search_engine`;--> statement-breakpoint
|
||||
DROP TABLE `search_engine`;--> statement-breakpoint
|
||||
ALTER TABLE `__new_search_engine` RENAME TO `search_engine`;--> statement-breakpoint
|
||||
PRAGMA foreign_keys=ON;
|
||||
1556
packages/db/migrations/sqlite/meta/0015_snapshot.json
Normal file
1556
packages/db/migrations/sqlite/meta/0015_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -106,6 +106,13 @@
|
||||
"when": 1729524387583,
|
||||
"tag": "0014_colorful_cargill",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 15,
|
||||
"version": "6",
|
||||
"when": 1730653336134,
|
||||
"tag": "0015_superb_psylocke",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import type {
|
||||
IntegrationKind,
|
||||
IntegrationPermission,
|
||||
IntegrationSecretKind,
|
||||
SearchEngineType,
|
||||
SectionKind,
|
||||
SupportedAuthProvider,
|
||||
WidgetKind,
|
||||
@@ -395,7 +396,9 @@ export const searchEngines = mysqlTable("search_engine", {
|
||||
name: varchar("name", { length: 64 }).notNull(),
|
||||
short: varchar("short", { length: 8 }).notNull(),
|
||||
description: text("description"),
|
||||
urlTemplate: text("url_template").notNull(),
|
||||
urlTemplate: text("url_template"),
|
||||
type: varchar("type", { length: 64 }).$type<SearchEngineType>().notNull().default("generic"),
|
||||
integrationId: varchar("integration_id", { length: 64 }).references(() => integrations.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const accountRelations = relations(accounts, ({ one }) => ({
|
||||
@@ -568,3 +571,10 @@ export const integrationItemRelations = relations(integrationItems, ({ one }) =>
|
||||
references: [items.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export const searchEngineRelations = relations(searchEngines, ({ one }) => ({
|
||||
integration: one(integrations, {
|
||||
fields: [searchEngines.integrationId],
|
||||
references: [integrations.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
@@ -16,6 +16,7 @@ import type {
|
||||
IntegrationKind,
|
||||
IntegrationPermission,
|
||||
IntegrationSecretKind,
|
||||
SearchEngineType,
|
||||
SectionKind,
|
||||
SupportedAuthProvider,
|
||||
WidgetKind,
|
||||
@@ -382,7 +383,9 @@ export const searchEngines = sqliteTable("search_engine", {
|
||||
name: text("name").notNull(),
|
||||
short: text("short").notNull(),
|
||||
description: text("description"),
|
||||
urlTemplate: text("url_template").notNull(),
|
||||
urlTemplate: text("url_template"),
|
||||
type: text("type").$type<SearchEngineType>().notNull().default("generic"),
|
||||
integrationId: text("integration_id").references(() => integrations.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const accountRelations = relations(accounts, ({ one }) => ({
|
||||
@@ -557,6 +560,13 @@ export const integrationItemRelations = relations(integrationItems, ({ one }) =>
|
||||
}),
|
||||
}));
|
||||
|
||||
export const searchEngineRelations = relations(searchEngines, ({ one }) => ({
|
||||
integration: one(integrations, {
|
||||
fields: [searchEngines.integrationId],
|
||||
references: [integrations.id],
|
||||
}),
|
||||
}));
|
||||
|
||||
export type User = InferSelectModel<typeof users>;
|
||||
export type Account = InferSelectModel<typeof accounts>;
|
||||
export type Session = InferSelectModel<typeof sessions>;
|
||||
|
||||
Reference in New Issue
Block a user