Skip to content

Commit

Permalink
fix: remove usage of custom jsonb after the upgrage of drizzle-orm
Browse files Browse the repository at this point in the history
§
  • Loading branch information
fgmadeira committed Oct 1, 2024
1 parent af2f6e2 commit 6b78c1d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 54 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-poets-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ethereal-nexus/dashboard': patch
---

fix: remove usage of custom jsonb after the upgrage of drizzle-orm
1 change: 0 additions & 1 deletion web/dashboard/src/data/components/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { jsonb, pgEnum, pgTable, primaryKey, text, timestamp, uuid } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';
import { customJson } from '@/db/custom-types';

export const assetTypeEnum = pgEnum('asset_type', ['css', 'js', 'chunk', 'server']);

Expand Down
5 changes: 2 additions & 3 deletions web/dashboard/src/data/events/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { pgEnum, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
import { jsonb, pgEnum, pgTable, timestamp, uuid } from 'drizzle-orm/pg-core';
import {users} from "@/data/users/schema";
import { customJsonb } from '@/db/custom-types';

export const eventsTypeEnum = pgEnum('event_type', [
'component_deactivated',
Expand All @@ -23,5 +22,5 @@ export const events = pgTable("event", {
resource_id: uuid('resource_id').notNull(),
user_id: uuid('user_id').notNull().references(() => users.id),
timestamp: timestamp("timestamp").defaultNow().notNull(),
data: customJsonb('data'),
data: jsonb('data'),
})
3 changes: 1 addition & 2 deletions web/dashboard/src/data/users/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,12 @@ export async function upsertApiKey(
.insert(apiKeys)
.values({
...input.data,
permission: sql`${input.data.permissions}::jsonb`,
})
.onConflictDoUpdate({
target: apiKeys.id,
set: {
alias: input.data.alias,
permissions: sql`${input.data.permissions}::jsonb`,
permissions: input.data.permissions,
},
})
.returning();
Expand Down
5 changes: 2 additions & 3 deletions web/dashboard/src/data/users/schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { pgEnum, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
import { customJsonb } from '@/db/custom-types';
import { jsonb, pgEnum, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';

export const userRolesEnum = pgEnum('roles', ['admin', 'user', 'viewer']);

Expand All @@ -20,7 +19,7 @@ export const apiKeys = pgTable('api_key', {
.notNull()
.references(() => users.id, { onDelete: 'cascade' }),
alias: text('alias'),
permissions: customJsonb('permissions'),
permissions: jsonb('permissions'),
created_at: timestamp('created_at').defaultNow().notNull(),
});

Expand Down
45 changes: 0 additions & 45 deletions web/dashboard/src/db/custom-types.ts

This file was deleted.

0 comments on commit 6b78c1d

Please sign in to comment.