feat: add videos table to schema and implement video upload route with metadata persistence
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { pgTable, timestamp, uuid, varchar } from 'drizzle-orm/pg-core';
|
||||
import { pgTable, timestamp, uuid, varchar, text } from 'drizzle-orm/pg-core';
|
||||
|
||||
export const users = pgTable('users', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
@@ -14,4 +14,17 @@ export const events = pgTable('events', {
|
||||
title: varchar('title', { length: 255 }).notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
videoUrl: varchar('video_url', { length: 255 }).notNull().unique(),
|
||||
});
|
||||
});
|
||||
|
||||
export const videos = pgTable('videos', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
userId: uuid('user_id').notNull().references(() => users.id),
|
||||
objectKey: varchar('object_key', { length: 1024 }).notNull().unique(),
|
||||
bucket: varchar('bucket', { length: 255 }).notNull(),
|
||||
uploadUrl: text('upload_url').notNull(),
|
||||
downloadUrl: text('download_url'),
|
||||
status: varchar('status', { length: 32 }).notNull().default('pending'),
|
||||
expiresAt: timestamp('expires_at', { withTimezone: true }),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user