瀏覽代碼

feat: 移除 knex 配置和数据库迁移文件,更新 tsconfig.json 文件

zyh 1 年之前
父節點
當前提交
ec6bb89019
共有 3 個文件被更改,包括 6 次插入6 次删除
  1. 2 2
      knexfile.js
  2. 3 3
      migrations/20240101000000_create_admin_user.js
  3. 1 1
      tsconfig.json

+ 2 - 2
knexfile.ts → knexfile.js

@@ -1,6 +1,6 @@
-import type { Knex } from "knex";
+/** @type {import('knex').Knex.Config} */
 
-const config: Knex.Config = {
+const config = {
   client: "sqlite3",
   connection: {
     filename: "./database.sqlite",

+ 3 - 3
migrations/20240101000000_create_admin_user.ts → migrations/20240101000000_create_admin_user.js

@@ -1,6 +1,6 @@
-import { Knex } from "knex";
+/** @type {import('knex').Knex} */
 
-export async function up(knex: Knex): Promise<void> {
+export async function up(knex) {
   await knex.schema.createTable("users", (table) => {
     table.increments("id").primary();
     table.string("username").notNullable().unique();
@@ -10,6 +10,6 @@ export async function up(knex: Knex): Promise<void> {
   });
 }
 
-export async function down(knex: Knex): Promise<void> {
+export async function down(knex) {
   await knex.schema.dropTable("users");
 }

+ 1 - 1
tsconfig.json

@@ -6,7 +6,7 @@
     "**/.server/**/*.tsx",
     "**/.client/**/*.ts",
     "**/.client/**/*.tsx"
-  ],
+, "knexfile.js" ],
   "compilerOptions": {
     "lib": ["DOM", "DOM.Iterable", "ES2022"],
     "types": ["@remix-run/node", "vite/client"],