# blog **Repository Path**: szh9690/blog ## Basic Information - **Project Name**: blog - **Description**: 基于shadcn-vue和cloudflare的个人博客 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-17 - **Last Updated**: 2025-07-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 1. pnpm install vue -w 注释:-w的意思是,workspace-root把依赖包安装到工作目录的根路径下,则根目录下会生成node_modules文件夹。可以共用,后续每个项目需要用到vue的,都直接从根目录node_modules里取。 pnpm install typescript -w -D 2. 执行分包下面的脚本 pnpm --filter www start www包 pnpm --filter *er start worker包 pnpm --filter * start 所有包 3. wrangler pages deploy dist --project-name 969052585 --precompress 4. function集成 打包后的worker 文件放到 dist下 改名为 _worker.js 5. 生成建表语句 pnpm install @libsql/client npx drizzle-kit generate npx drizzle-kit push 6. 导出线上数据 npx wrangler d1 export YOUR_DB --remote --output=./database.sql npx wrangler d1 export YOUR_DB --remote --table=YOUR_TABLE --output=./table.sql --no-schema ```javascript import { sqliteTable, integer, text } from 'drizzle-orm/sqlite-core'; import { sql } from 'drizzle-orm'; import { CommonColumn } from './common'; // 模块表(原板块表) const Modules = sqliteTable('module', { moduleId: integer().primaryKey({ autoIncrement: true }), moduleName: text().notNull(), description: text(), [CommonColumn.CreatedAt]: text() .notNull() .default(sql`(current_timestamp)`), [CommonColumn.UpdatedAt]: text() }); // 分类表 const Categories = sqliteTable('categories', { categoryId: integer().primaryKey({ autoIncrement: true }), categoryName: text().notNull(), parentCategoryId: integer().references(() => Categories.categoryId), [CommonColumn.CreatedAt]: text() .notNull() .default(sql`(current_timestamp)`), [CommonColumn.UpdatedAt]: text() }); // 模块与分类关联表 const ModuleCategoryRelations = sqliteTable('module_category_relations', { relationId: integer().primaryKey({ autoIncrement: true }), moduleId: integer().references(() => Modules.moduleId), categoryId: integer().references(() => Categories.categoryId), [CommonColumn.CreatedAt]: text() .notNull() .default(sql`(current_timestamp)`), [CommonColumn.UpdatedAt]: text() }); // 标签表 const Tags = sqliteTable('tags', { tagId: integer().primaryKey({ autoIncrement: true }), tagName: text().notNull(), [CommonColumn.CreatedAt]: text() .notNull() .default(sql`(current_timestamp)`), [CommonColumn.UpdatedAt]: text() }); // 文章表 const Articles = sqliteTable('articles', { articleId: integer().primaryKey({ autoIncrement: true }), title: text().notNull(), content: text().notNull(), moduleId: integer().references(() => Modules.moduleId), [CommonColumn.CreatedAt]: text() .notNull() .default(sql`(current_timestamp)`), [CommonColumn.UpdatedAt]: text() }); // 文章与分类关联表 const ArticleCategoryRelations = sqliteTable('article_category_relations', { relationId: integer().primaryKey({ autoIncrement: true }), articleId: integer().references(() => Articles.articleId), categoryId: integer().references(() => Categories.categoryId), [CommonColumn.CreatedAt]: text() .notNull() .default(sql`(current_timestamp)`), [CommonColumn.UpdatedAt]: text() }); // 文章与标签关联表 const ArticleTagRelations = sqliteTable('article_tag_relations', { relationId: integer().primaryKey({ autoIncrement: true }), articleId: integer().references(() => Articles.articleId), tagId: integer().references(() => Tags.tagId), [CommonColumn.CreatedAt]: text() .notNull() .default(sql`(current_timestamp)`), [CommonColumn.UpdatedAt]: text() }); export { Modules, Categories, ModuleCategoryRelations, Tags, Articles, ArticleCategoryRelations, ArticleTagRelations }; ```