mirror of https://github.com/buster-so/buster.git
database now has docs table
This commit is contained in:
parent
d140a8f8d2
commit
cae94ae56a
|
@ -0,0 +1,13 @@
|
|||
CREATE TYPE "public"."docs_type_enum" AS ENUM('analyst', 'normal');--> statement-breakpoint
|
||||
CREATE TABLE "docs" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"content" text NOT NULL,
|
||||
"type" "docs_type_enum" DEFAULT 'normal' NOT NULL,
|
||||
"organization_id" uuid NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"deleted_at" timestamp with time zone
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "docs" ADD CONSTRAINT "docs_organization_id_fkey" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;
|
File diff suppressed because it is too large
Load Diff
|
@ -645,6 +645,13 @@
|
|||
"when": 1756995817124,
|
||||
"tag": "0091_fine_sinister_six",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 92,
|
||||
"version": "7",
|
||||
"when": 1757364170176,
|
||||
"tag": "0092_high_wendell_vaughn",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -35,3 +35,4 @@ export type UserOrganizationRole =
|
|||
| 'querier'
|
||||
| 'restricted_querier'
|
||||
| 'viewer';
|
||||
|
||||
|
|
|
@ -129,6 +129,8 @@ export const workspaceSharingEnum = pgEnum('workspace_sharing_enum', [
|
|||
'full_access',
|
||||
]);
|
||||
|
||||
export const docsTypeEnum = pgEnum('docs_type_enum', ['analyst', 'normal']);
|
||||
|
||||
export const apiKeys = pgTable(
|
||||
'api_keys',
|
||||
{
|
||||
|
@ -2290,3 +2292,28 @@ export const messagesToSlackMessages = pgTable(
|
|||
),
|
||||
]
|
||||
);
|
||||
|
||||
export const docs = pgTable(
|
||||
'docs',
|
||||
{
|
||||
id: uuid().defaultRandom().primaryKey().notNull(),
|
||||
name: varchar('name', { length: 255 }).notNull(),
|
||||
content: text().notNull(),
|
||||
type: docsTypeEnum().default('normal').notNull(),
|
||||
organizationId: uuid('organization_id').notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true, mode: 'string' })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true, mode: 'string' })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
deletedAt: timestamp('deleted_at', { withTimezone: true, mode: 'string' }),
|
||||
},
|
||||
(table) => [
|
||||
foreignKey({
|
||||
columns: [table.organizationId],
|
||||
foreignColumns: [organizations.id],
|
||||
name: 'docs_organization_id_fkey',
|
||||
}).onDelete('cascade'),
|
||||
]
|
||||
)
|
Loading…
Reference in New Issue