UNPKG

realworld-hono-drizzle

Version:
590 lines (583 loc) 20 kB
import * as hono from 'hono'; import * as hono_types from 'hono/types'; import { LibSQLDatabase } from 'drizzle-orm/libsql'; import * as drizzle_orm from 'drizzle-orm'; import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core'; declare const usersTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{ name: "users"; schema: undefined; columns: { id: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "id"; tableName: "users"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; isPrimaryKey: true; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; email: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "email"; tableName: "users"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; username: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "username"; tableName: "users"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; bio: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "bio"; tableName: "users"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: false; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; image: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "image"; tableName: "users"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: false; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; passwordHash: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "passwordHash"; tableName: "users"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; }; dialect: "sqlite"; }>; declare const userFollowTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{ name: "user_follow"; schema: undefined; columns: { followerId: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "followerId"; tableName: "user_follow"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; followedId: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "followedId"; tableName: "user_follow"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; }; dialect: "sqlite"; }>; declare const userFollowRelations: drizzle_orm.Relations<"user_follow", { follower: drizzle_orm.One<"users", true>; followed: drizzle_orm.One<"users", true>; }>; declare const tagsTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{ name: "tags"; schema: undefined; columns: { tag: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "tag"; tableName: "tags"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; }; dialect: "sqlite"; }>; declare const articlesTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{ name: "articles"; schema: undefined; columns: { slug: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "slug"; tableName: "articles"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: true; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; title: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "title"; tableName: "articles"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; description: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "description"; tableName: "articles"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; body: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "body"; tableName: "articles"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "createdAt"; tableName: "articles"; dataType: "custom"; columnType: "SQLiteCustomColumn"; data: string; driverParam: string; notNull: true; hasDefault: true; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, { sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand"; }>; updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "updatedAt"; tableName: "articles"; dataType: "custom"; columnType: "SQLiteCustomColumn"; data: string; driverParam: string; notNull: true; hasDefault: true; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, { sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand"; }>; authorId: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "authorId"; tableName: "articles"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; }; dialect: "sqlite"; }>; declare const commentsTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{ name: "comments"; schema: undefined; columns: { id: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "id"; tableName: "comments"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: true; isPrimaryKey: true; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "createdAt"; tableName: "comments"; dataType: "custom"; columnType: "SQLiteCustomColumn"; data: string; driverParam: string; notNull: true; hasDefault: true; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, { sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand"; }>; updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "updatedAt"; tableName: "comments"; dataType: "custom"; columnType: "SQLiteCustomColumn"; data: string; driverParam: string; notNull: true; hasDefault: true; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, { sqliteColumnBuilderBrand: "SQLiteCustomColumnBuilderBrand"; }>; body: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "body"; tableName: "comments"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; articleSlug: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "articleSlug"; tableName: "comments"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; authorId: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "authorId"; tableName: "comments"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; }; dialect: "sqlite"; }>; declare const articleTagTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{ name: "article_tag"; schema: undefined; columns: { articleSlug: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "articleSlug"; tableName: "article_tag"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; tag: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "tag"; tableName: "article_tag"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; }; dialect: "sqlite"; }>; declare const articleFavoriteTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{ name: "article_favorite"; schema: undefined; columns: { articleSlug: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "articleSlug"; tableName: "article_favorite"; dataType: "string"; columnType: "SQLiteText"; data: string; driverParam: string; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: [string, ...string[]]; baseColumn: never; identity: undefined; generated: undefined; }, {}, { length: undefined; }>; userId: drizzle_orm_sqlite_core.SQLiteColumn<{ name: "userId"; tableName: "article_favorite"; dataType: "number"; columnType: "SQLiteInteger"; data: number; driverParam: number; notNull: true; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: undefined; baseColumn: never; identity: undefined; generated: undefined; }, {}, {}>; }; dialect: "sqlite"; }>; declare const articleRelations: drizzle_orm.Relations<"articles", { author: drizzle_orm.One<"users", true>; tagList: drizzle_orm.Many<"article_tag">; commentRelations: drizzle_orm.Many<"comments">; }>; declare const tagRelations: drizzle_orm.Relations<"tags", { articles: drizzle_orm.Many<"article_tag">; }>; declare const articleTagRelations: drizzle_orm.Relations<"article_tag", { article: drizzle_orm.One<"articles", true>; tag: drizzle_orm.One<"tags", true>; }>; declare const commentRelations: drizzle_orm.Relations<"comments", { article: drizzle_orm.One<"articles", true>; }>; declare const schema_articleFavoriteTable: typeof articleFavoriteTable; declare const schema_articleRelations: typeof articleRelations; declare const schema_articleTagRelations: typeof articleTagRelations; declare const schema_articleTagTable: typeof articleTagTable; declare const schema_articlesTable: typeof articlesTable; declare const schema_commentRelations: typeof commentRelations; declare const schema_commentsTable: typeof commentsTable; declare const schema_tagRelations: typeof tagRelations; declare const schema_tagsTable: typeof tagsTable; declare const schema_userFollowRelations: typeof userFollowRelations; declare const schema_userFollowTable: typeof userFollowTable; declare const schema_usersTable: typeof usersTable; declare namespace schema { export { schema_articleFavoriteTable as articleFavoriteTable, schema_articleRelations as articleRelations, schema_articleTagRelations as articleTagRelations, schema_articleTagTable as articleTagTable, schema_articlesTable as articlesTable, schema_commentRelations as commentRelations, schema_commentsTable as commentsTable, schema_tagRelations as tagRelations, schema_tagsTable as tagsTable, schema_userFollowRelations as userFollowRelations, schema_userFollowTable as userFollowTable, schema_usersTable as usersTable }; } interface ThisAppEnv { Variables: { db: LibSQLDatabase<typeof schema>; }; Bindings: { DATABASE_URL: string; JWT_SECRET: string; }; } declare const _default: hono.Hono<ThisAppEnv, hono_types.BlankSchema, "/">; /** Create the tables in the given database. */ declare function applyMigrations(databaseUrl: string): Promise<void>; /** Populate the database with fake values. */ declare function seed(databaseUrl: string): Promise<void>; export { applyMigrations, _default as default, seed };