mirror of
https://github.com/haexhub/haex-hub.git
synced 2025-12-17 06:30:50 +01:00
no more soft delete => we do it hard now
This commit is contained in:
@ -77,7 +77,11 @@ export const haexExtensionPermissions = sqliteTable(
|
||||
.$defaultFn(() => crypto.randomUUID()),
|
||||
extensionId: text(
|
||||
tableNames.haex.extension_permissions.columns.extensionId,
|
||||
).references((): AnySQLiteColumn => haexExtensions.id),
|
||||
)
|
||||
.notNull()
|
||||
.references((): AnySQLiteColumn => haexExtensions.id, {
|
||||
onDelete: 'cascade',
|
||||
}),
|
||||
resourceType: text('resource_type', {
|
||||
enum: ['fs', 'http', 'db', 'shell'],
|
||||
}),
|
||||
@ -152,6 +156,7 @@ export const haexWorkspaces = sqliteTable(
|
||||
},
|
||||
tableNames.haex.workspaces.columns,
|
||||
),
|
||||
(table) => [unique().on(table.position)],
|
||||
)
|
||||
export type InsertHaexWorkspaces = typeof haexWorkspaces.$inferInsert
|
||||
export type SelectHaexWorkspaces = typeof haexWorkspaces.$inferSelect
|
||||
@ -165,7 +170,7 @@ export const haexDesktopItems = sqliteTable(
|
||||
.$defaultFn(() => crypto.randomUUID()),
|
||||
workspaceId: text(tableNames.haex.desktop_items.columns.workspaceId)
|
||||
.notNull()
|
||||
.references(() => haexWorkspaces.id),
|
||||
.references(() => haexWorkspaces.id, { onDelete: 'cascade' }),
|
||||
itemType: text(tableNames.haex.desktop_items.columns.itemType, {
|
||||
enum: ['extension', 'file', 'folder'],
|
||||
}).notNull(),
|
||||
|
||||
@ -35,9 +35,11 @@ export const haexPasswordsItemKeyValues = sqliteTable(
|
||||
tableNames.haex.passwords.item_key_values,
|
||||
{
|
||||
id: text().primaryKey(),
|
||||
itemId: text('item_id').references(
|
||||
(): AnySQLiteColumn => haexPasswordsItemDetails.id,
|
||||
),
|
||||
itemId: text('item_id')
|
||||
.notNull()
|
||||
.references((): AnySQLiteColumn => haexPasswordsItemDetails.id, {
|
||||
onDelete: 'cascade',
|
||||
}),
|
||||
key: text(),
|
||||
value: text(),
|
||||
updateAt: integer('updated_at', { mode: 'timestamp' }).$onUpdate(
|
||||
@ -55,9 +57,11 @@ export const haexPasswordsItemHistory = sqliteTable(
|
||||
tableNames.haex.passwords.item_histories,
|
||||
{
|
||||
id: text().primaryKey(),
|
||||
itemId: text('item_id').references(
|
||||
(): AnySQLiteColumn => haexPasswordsItemDetails.id,
|
||||
),
|
||||
itemId: text('item_id')
|
||||
.notNull()
|
||||
.references((): AnySQLiteColumn => haexPasswordsItemDetails.id, {
|
||||
onDelete: 'cascade',
|
||||
}),
|
||||
changedProperty:
|
||||
text('changed_property').$type<keyof typeof haexPasswordsItemDetails>(),
|
||||
oldValue: text('old_value'),
|
||||
@ -82,6 +86,7 @@ export const haexPasswordsGroups = sqliteTable(
|
||||
color: text(),
|
||||
parentId: text('parent_id').references(
|
||||
(): AnySQLiteColumn => haexPasswordsGroups.id,
|
||||
{ onDelete: 'cascade' },
|
||||
),
|
||||
createdAt: text('created_at').default(sql`(CURRENT_TIMESTAMP)`),
|
||||
updateAt: integer('updated_at', { mode: 'timestamp' }).$onUpdate(
|
||||
@ -96,12 +101,16 @@ export type SelectHaexPasswordsGroups = typeof haexPasswordsGroups.$inferSelect
|
||||
export const haexPasswordsGroupItems = sqliteTable(
|
||||
tableNames.haex.passwords.group_items,
|
||||
{
|
||||
groupId: text('group_id').references(
|
||||
(): AnySQLiteColumn => haexPasswordsGroups.id,
|
||||
),
|
||||
itemId: text('item_id').references(
|
||||
(): AnySQLiteColumn => haexPasswordsItemDetails.id,
|
||||
),
|
||||
groupId: text('group_id')
|
||||
.notNull()
|
||||
.references((): AnySQLiteColumn => haexPasswordsGroups.id, {
|
||||
onDelete: 'cascade',
|
||||
}),
|
||||
itemId: text('item_id')
|
||||
.notNull()
|
||||
.references((): AnySQLiteColumn => haexPasswordsItemDetails.id, {
|
||||
onDelete: 'cascade',
|
||||
}),
|
||||
haex_tombstone: integer({ mode: 'boolean' }),
|
||||
},
|
||||
(table) => [primaryKey({ columns: [table.itemId, table.groupId] })],
|
||||
|
||||
Reference in New Issue
Block a user