mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Remove unnecessary lint rules from deno.json, avoid explicit any
This commit is contained in:
parent
359558e2d6
commit
a2de8cdf82
51 changed files with 97 additions and 98 deletions
10
deno.json
10
deno.json
|
|
@ -100,16 +100,6 @@
|
||||||
"zod": "npm:zod@^3.23.8",
|
"zod": "npm:zod@^3.23.8",
|
||||||
"~/fixtures/": "./fixtures/"
|
"~/fixtures/": "./fixtures/"
|
||||||
},
|
},
|
||||||
"lint": {
|
|
||||||
"rules": {
|
|
||||||
"tags": [
|
|
||||||
"recommended"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"no-explicit-any"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fmt": {
|
"fmt": {
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"lineWidth": 120,
|
"lineWidth": 120,
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,7 @@ export interface AppEnv extends HonoEnv {
|
||||||
|
|
||||||
type AppContext = Context<AppEnv>;
|
type AppContext = Context<AppEnv>;
|
||||||
type AppMiddleware = MiddlewareHandler<AppEnv>;
|
type AppMiddleware = MiddlewareHandler<AppEnv>;
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
type AppController<P extends string = any> = Handler<AppEnv, P, HonoInput, Response | Promise<Response>>;
|
type AppController<P extends string = any> = Handler<AppEnv, P, HonoInput, Response | Promise<Response>>;
|
||||||
|
|
||||||
const app = new Hono<AppEnv>({ strict: false });
|
const app = new Hono<AppEnv>({ strict: false });
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('events')
|
.createTable('events')
|
||||||
.addColumn('id', 'text', (col) => col.primaryKey())
|
.addColumn('id', 'text', (col) => col.primaryKey())
|
||||||
|
|
@ -52,7 +52,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('events').execute();
|
await db.schema.dropTable('events').execute();
|
||||||
await db.schema.dropTable('tags').execute();
|
await db.schema.dropTable('tags').execute();
|
||||||
await db.schema.dropTable('users').execute();
|
await db.schema.dropTable('users').execute();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('relays')
|
.createTable('relays')
|
||||||
.addColumn('url', 'text', (col) => col.primaryKey())
|
.addColumn('url', 'text', (col) => col.primaryKey())
|
||||||
|
|
@ -9,6 +9,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('relays').execute();
|
await db.schema.dropTable('relays').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(_db: Kysely<any>): Promise<void> {
|
export async function up(_db: Kysely<unknown>): Promise<void> {
|
||||||
// This migration used to create an FTS table for SQLite, but SQLite support was removed.
|
// This migration used to create an FTS table for SQLite, but SQLite support was removed.
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(_db: Kysely<any>): Promise<void> {
|
export async function down(_db: Kysely<unknown>): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(_db: Kysely<any>): Promise<void> {
|
export async function up(_db: Kysely<unknown>): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('users').dropColumn('admin').execute();
|
await db.schema.alterTable('users').dropColumn('admin').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(_db: Kysely<any>): Promise<void> {
|
export async function up(_db: Kysely<unknown>): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_users_pubkey').execute();
|
await db.schema.dropIndex('idx_users_pubkey').execute();
|
||||||
await db.schema.dropIndex('idx_users_username').execute();
|
await db.schema.dropIndex('idx_users_username').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('tags_new')
|
.createTable('tags_new')
|
||||||
.addColumn('tag', 'text', (col) => col.notNull())
|
.addColumn('tag', 'text', (col) => col.notNull())
|
||||||
|
|
@ -42,7 +42,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('tags').execute();
|
await db.schema.dropTable('tags').execute();
|
||||||
|
|
||||||
await db.schema
|
await db.schema
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(_db: Kysely<any>): Promise<void> {
|
export async function up(_db: Kysely<unknown>): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(_db: Kysely<any>): Promise<void> {
|
export async function down(_db: Kysely<unknown>): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('unattached_media')
|
.createTable('unattached_media')
|
||||||
.addColumn('id', 'text', (c) => c.primaryKey())
|
.addColumn('id', 'text', (c) => c.primaryKey())
|
||||||
|
|
@ -29,6 +29,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('unattached_media').execute();
|
await db.schema.dropTable('unattached_media').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(_db: Kysely<any>): Promise<void> {
|
export async function up(_db: Kysely<unknown>): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(_db: Kysely<any>): Promise<void> {
|
export async function down(_db: Kysely<unknown>): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('author_stats')
|
.createTable('author_stats')
|
||||||
.addColumn('pubkey', 'text', (col) => col.primaryKey())
|
.addColumn('pubkey', 'text', (col) => col.primaryKey())
|
||||||
|
|
@ -18,7 +18,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('author_stats').execute();
|
await db.schema.dropTable('author_stats').execute();
|
||||||
await db.schema.dropTable('event_stats').execute();
|
await db.schema.dropTable('event_stats').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('users').ifExists().execute();
|
await db.schema.dropTable('users').ifExists().execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(_db: Kysely<any>): Promise<void> {
|
export async function down(_db: Kysely<unknown>): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createIndex('idx_events_kind_pubkey_created_at')
|
.createIndex('idx_events_kind_pubkey_created_at')
|
||||||
.on('events')
|
.on('events')
|
||||||
|
|
@ -8,6 +8,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_events_kind_pubkey_created_at').execute();
|
await db.schema.dropIndex('idx_events_kind_pubkey_created_at').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_tags_tag').execute();
|
await db.schema.dropIndex('idx_tags_tag').execute();
|
||||||
await db.schema.dropIndex('idx_tags_value').execute();
|
await db.schema.dropIndex('idx_tags_value').execute();
|
||||||
|
|
||||||
|
|
@ -11,7 +11,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_tags_tag_value').execute();
|
await db.schema.dropIndex('idx_tags_tag_value').execute();
|
||||||
|
|
||||||
await db.schema
|
await db.schema
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('events').addColumn('deleted_at', 'integer').execute();
|
await db.schema.alterTable('events').addColumn('deleted_at', 'integer').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('events').dropColumn('deleted_at').execute();
|
await db.schema.alterTable('events').dropColumn('deleted_at').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.createIndex('idx_author_stats_pubkey').on('author_stats').column('pubkey').execute();
|
await db.schema.createIndex('idx_author_stats_pubkey').on('author_stats').column('pubkey').execute();
|
||||||
await db.schema.createIndex('idx_event_stats_event_id').on('event_stats').column('event_id').execute();
|
await db.schema.createIndex('idx_event_stats_event_id').on('event_stats').column('event_id').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_author_stats_pubkey').on('author_stats').execute();
|
await db.schema.dropIndex('idx_author_stats_pubkey').on('author_stats').execute();
|
||||||
await db.schema.dropIndex('idx_event_stats_event_id').on('event_stats').execute();
|
await db.schema.dropIndex('idx_event_stats_event_id').on('event_stats').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('pubkey_domains')
|
.createTable('pubkey_domains')
|
||||||
.ifNotExists()
|
.ifNotExists()
|
||||||
|
|
@ -16,6 +16,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('pubkey_domains').execute();
|
await db.schema.dropTable('pubkey_domains').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('pubkey_domains')
|
.alterTable('pubkey_domains')
|
||||||
.addColumn('last_updated_at', 'integer', (col) => col.notNull().defaultTo(0))
|
.addColumn('last_updated_at', 'integer', (col) => col.notNull().defaultTo(0))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('pubkey_domains').dropColumn('last_updated_at').execute();
|
await db.schema.alterTable('pubkey_domains').dropColumn('last_updated_at').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('relays').execute();
|
await db.schema.dropTable('relays').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('relays')
|
.createTable('relays')
|
||||||
.addColumn('url', 'text', (col) => col.primaryKey())
|
.addColumn('url', 'text', (col) => col.primaryKey())
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createIndex('idx_events_created_at_kind')
|
.createIndex('idx_events_created_at_kind')
|
||||||
.on('events')
|
.on('events')
|
||||||
|
|
@ -9,6 +9,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_events_created_at_kind').ifExists().execute();
|
await db.schema.dropIndex('idx_events_created_at_kind').ifExists().execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('events').renameTo('nostr_events').execute();
|
await db.schema.alterTable('events').renameTo('nostr_events').execute();
|
||||||
await db.schema.alterTable('tags').renameTo('nostr_tags').execute();
|
await db.schema.alterTable('tags').renameTo('nostr_tags').execute();
|
||||||
await db.schema.alterTable('nostr_tags').renameColumn('tag', 'name').execute();
|
await db.schema.alterTable('nostr_tags').renameColumn('tag', 'name').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('nostr_events').renameTo('events').execute();
|
await db.schema.alterTable('nostr_events').renameTo('events').execute();
|
||||||
await db.schema.alterTable('nostr_tags').renameTo('tags').execute();
|
await db.schema.alterTable('nostr_tags').renameTo('tags').execute();
|
||||||
await db.schema.alterTable('tags').renameColumn('name', 'tag').execute();
|
await db.schema.alterTable('tags').renameColumn('name', 'tag').execute();
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.deleteFrom('nostr_events').where('deleted_at', 'is not', null).execute();
|
await db.deleteFrom('nostr_events').where('deleted_at', 'is not', null).execute();
|
||||||
await db.schema.alterTable('nostr_events').dropColumn('deleted_at').execute();
|
await db.schema.alterTable('nostr_events').dropColumn('deleted_at').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('nostr_events').addColumn('deleted_at', 'integer').execute();
|
await db.schema.alterTable('nostr_events').addColumn('deleted_at', 'integer').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.createTable('nostr_pgfts')
|
await db.schema.createTable('nostr_pgfts')
|
||||||
.ifNotExists()
|
.ifNotExists()
|
||||||
.addColumn('event_id', 'text', (c) => c.primaryKey().references('nostr_events.id').onDelete('cascade'))
|
.addColumn('event_id', 'text', (c) => c.primaryKey().references('nostr_events.id').onDelete('cascade'))
|
||||||
|
|
@ -8,6 +8,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('nostr_pgfts').ifExists().execute();
|
await db.schema.dropTable('nostr_pgfts').ifExists().execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createIndex('nostr_pgfts_gin_search_vec')
|
.createIndex('nostr_pgfts_gin_search_vec')
|
||||||
.ifNotExists()
|
.ifNotExists()
|
||||||
|
|
@ -10,6 +10,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('nostr_pgfts_gin_search_vec').ifExists().execute();
|
await db.schema.dropIndex('nostr_pgfts_gin_search_vec').ifExists().execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('event_stats')
|
.alterTable('event_stats')
|
||||||
.addColumn('reactions', 'text', (col) => col.defaultTo('{}'))
|
.addColumn('reactions', 'text', (col) => col.defaultTo('{}'))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('event_stats').dropColumn('reactions').execute();
|
await db.schema.alterTable('event_stats').dropColumn('reactions').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('nip46_tokens')
|
.createTable('nip46_tokens')
|
||||||
.addColumn('api_token', 'text', (col) => col.primaryKey().notNull())
|
.addColumn('api_token', 'text', (col) => col.primaryKey().notNull())
|
||||||
|
|
@ -12,6 +12,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('nip46_tokens').execute();
|
await db.schema.dropTable('nip46_tokens').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('event_stats')
|
.alterTable('event_stats')
|
||||||
.addColumn('quotes_count', 'integer', (col) => col.notNull().defaultTo(0))
|
.addColumn('quotes_count', 'integer', (col) => col.notNull().defaultTo(0))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('event_stats').dropColumn('quotes_count').execute();
|
await db.schema.alterTable('event_stats').dropColumn('quotes_count').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('event_stats')
|
.alterTable('event_stats')
|
||||||
.addColumn('zaps_amount', 'integer', (col) => col.notNull().defaultTo(0))
|
.addColumn('zaps_amount', 'integer', (col) => col.notNull().defaultTo(0))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('event_stats').dropColumn('zaps_amount').execute();
|
await db.schema.alterTable('event_stats').dropColumn('zaps_amount').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createIndex('idx_tags_name')
|
.createIndex('idx_tags_name')
|
||||||
.on('nostr_tags')
|
.on('nostr_tags')
|
||||||
|
|
@ -9,6 +9,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_tags_name').ifExists().execute();
|
await db.schema.dropIndex('idx_tags_name').ifExists().execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('event_zaps')
|
.createTable('event_zaps')
|
||||||
.addColumn('receipt_id', 'text', (col) => col.primaryKey())
|
.addColumn('receipt_id', 'text', (col) => col.primaryKey())
|
||||||
|
|
@ -25,7 +25,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_event_zaps_amount_millisats').ifExists().execute();
|
await db.schema.dropIndex('idx_event_zaps_amount_millisats').ifExists().execute();
|
||||||
await db.schema.dropIndex('idx_event_zaps_target_event_id').ifExists().execute();
|
await db.schema.dropIndex('idx_event_zaps_target_event_id').ifExists().execute();
|
||||||
await db.schema.dropTable('event_zaps').execute();
|
await db.schema.dropTable('event_zaps').execute();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createIndex('nostr_events_created_at_kind')
|
.createIndex('nostr_events_created_at_kind')
|
||||||
.on('nostr_events')
|
.on('nostr_events')
|
||||||
|
|
@ -19,7 +19,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_events_kind_pubkey_created_at').execute();
|
await db.schema.dropIndex('idx_events_kind_pubkey_created_at').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('nostr_events_created_at_kind').execute();
|
await db.schema.dropIndex('nostr_events_created_at_kind').execute();
|
||||||
await db.schema.dropIndex('nostr_events_kind_pubkey_created_at').execute();
|
await db.schema.dropIndex('nostr_events_kind_pubkey_created_at').execute();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('nostr_tags_new')
|
.createTable('nostr_tags_new')
|
||||||
.addColumn('event_id', 'text', (col) => col.notNull().references('nostr_events.id').onDelete('cascade'))
|
.addColumn('event_id', 'text', (col) => col.notNull().references('nostr_events.id').onDelete('cascade'))
|
||||||
|
|
@ -66,7 +66,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('nostr_tags_old')
|
.createTable('nostr_tags_old')
|
||||||
.addColumn('event_id', 'text', (col) => col.references('nostr_events.id').onDelete('cascade'))
|
.addColumn('event_id', 'text', (col) => col.references('nostr_events.id').onDelete('cascade'))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
// Create new table and indexes.
|
// Create new table and indexes.
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('nostr_events_new')
|
.createTable('nostr_events_new')
|
||||||
|
|
@ -132,6 +132,6 @@ If you don't want to wait, you can create a fresh database and then import your
|
||||||
await db.schema.alterTable('nostr_events_new').renameTo('nostr_events').execute();
|
await db.schema.alterTable('nostr_events_new').renameTo('nostr_events').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function down(_db: Kysely<any>): Promise<void> {
|
export function down(_db: Kysely<unknown>): Promise<void> {
|
||||||
throw new Error("Sorry, you can't migrate back from here.");
|
throw new Error("Sorry, you can't migrate back from here.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('unattached_media').execute();
|
await db.schema.dropTable('unattached_media').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('unattached_media')
|
.createTable('unattached_media')
|
||||||
.addColumn('id', 'text', (c) => c.primaryKey())
|
.addColumn('id', 'text', (c) => c.primaryKey())
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('author_search')
|
.createTable('author_search')
|
||||||
.addColumn('pubkey', 'char(64)', (col) => col.primaryKey())
|
.addColumn('pubkey', 'char(64)', (col) => col.primaryKey())
|
||||||
|
|
@ -12,7 +12,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await sql`CREATE INDEX author_search_search_idx ON author_search USING GIN (search gin_trgm_ops)`.execute(db);
|
await sql`CREATE INDEX author_search_search_idx ON author_search USING GIN (search gin_trgm_ops)`.execute(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('author_search_search_idx').ifExists().execute();
|
await db.schema.dropIndex('author_search_search_idx').ifExists().execute();
|
||||||
await db.schema.dropTable('author_search').execute();
|
await db.schema.dropTable('author_search').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('nostr_events').addColumn('language', 'char(2)').execute();
|
await db.schema.alterTable('nostr_events').addColumn('language', 'char(2)').execute();
|
||||||
|
|
||||||
await db.schema.createIndex('nostr_events_language_created_idx')
|
await db.schema.createIndex('nostr_events_language_created_idx')
|
||||||
|
|
@ -9,7 +9,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('nostr_events').dropColumn('language').execute();
|
await db.schema.alterTable('nostr_events').dropColumn('language').execute();
|
||||||
await db.schema.dropIndex('nostr_events_language_created_idx').execute();
|
await db.schema.dropIndex('nostr_events_language_created_idx').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('author_stats')
|
.alterTable('author_stats')
|
||||||
|
|
@ -26,7 +27,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.schema.dropTable('author_search').execute();
|
await db.schema.dropTable('author_search').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('author_stats_search_idx').ifExists().execute();
|
await db.schema.dropIndex('author_stats_search_idx').ifExists().execute();
|
||||||
await db.schema.alterTable('author_stats').dropColumn('search').execute();
|
await db.schema.alterTable('author_stats').dropColumn('search').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createIndex('author_stats_followers_count_idx')
|
.createIndex('author_stats_followers_count_idx')
|
||||||
.ifNotExists()
|
.ifNotExists()
|
||||||
|
|
@ -12,6 +12,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.schema.dropIndex('idx_author_stats_pubkey').ifExists().execute();
|
await db.schema.dropIndex('idx_author_stats_pubkey').ifExists().execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropIndex('author_stats_followers_count_idx').ifExists().execute();
|
await db.schema.dropIndex('author_stats_followers_count_idx').ifExists().execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.deleteFrom('event_stats').where(sql<number>`length(event_id)`, '>', 64).execute();
|
await db.deleteFrom('event_stats').where(sql<number>`length(event_id)`, '>', 64).execute();
|
||||||
await db.deleteFrom('author_stats').where(sql<number>`length(pubkey)`, '>', 64).execute();
|
await db.deleteFrom('author_stats').where(sql<number>`length(pubkey)`, '>', 64).execute();
|
||||||
|
|
@ -8,7 +9,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.schema.alterTable('author_stats').alterColumn('pubkey', (col) => col.setDataType('char(64)')).execute();
|
await db.schema.alterTable('author_stats').alterColumn('pubkey', (col) => col.setDataType('char(64)')).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('event_stats').alterColumn('event_id', (col) => col.setDataType('text')).execute();
|
await db.schema.alterTable('event_stats').alterColumn('event_id', (col) => col.setDataType('text')).execute();
|
||||||
await db.schema.alterTable('author_stats').alterColumn('pubkey', (col) => col.setDataType('text')).execute();
|
await db.schema.alterTable('author_stats').alterColumn('pubkey', (col) => col.setDataType('text')).execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createTable('push_subscriptions')
|
.createTable('push_subscriptions')
|
||||||
.addColumn('id', 'bigserial', (c) => c.primaryKey())
|
.addColumn('id', 'bigserial', (c) => c.primaryKey())
|
||||||
|
|
@ -22,6 +22,6 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('push_subscriptions').execute();
|
await db.schema.dropTable('push_subscriptions').execute();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await sql`
|
await sql`
|
||||||
CREATE OR REPLACE FUNCTION notify_nostr_event()
|
CREATE OR REPLACE FUNCTION notify_nostr_event()
|
||||||
RETURNS TRIGGER AS $$
|
RETURNS TRIGGER AS $$
|
||||||
|
|
@ -31,7 +31,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
`.execute(db);
|
`.execute(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await sql`DROP TRIGGER nostr_event_trigger ON nostr_events`.execute(db);
|
await sql`DROP TRIGGER nostr_event_trigger ON nostr_events`.execute(db);
|
||||||
await sql`DROP FUNCTION notify_nostr_event()`.execute(db);
|
await sql`DROP FUNCTION notify_nostr_event()`.execute(db);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('auth_tokens')
|
.alterTable('auth_tokens')
|
||||||
|
|
@ -14,7 +15,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('auth_tokens')
|
.alterTable('auth_tokens')
|
||||||
.dropColumn('bunker_pubkey')
|
.dropColumn('bunker_pubkey')
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await sql`DROP TRIGGER IF EXISTS nostr_event_trigger ON nostr_events`.execute(db);
|
await sql`DROP TRIGGER IF EXISTS nostr_event_trigger ON nostr_events`.execute(db);
|
||||||
|
|
||||||
await sql`
|
await sql`
|
||||||
|
|
@ -21,7 +21,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
`.execute(db);
|
`.execute(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await sql`DROP TRIGGER nostr_event_trigger ON nostr_events`.execute(db);
|
await sql`DROP TRIGGER nostr_event_trigger ON nostr_events`.execute(db);
|
||||||
await sql`DROP FUNCTION notify_nostr_event()`.execute(db);
|
await sql`DROP FUNCTION notify_nostr_event()`.execute(db);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('nostr_events')
|
.alterTable('nostr_events')
|
||||||
.addColumn('search_ext', 'jsonb', (col) => col.notNull().defaultTo(sql`'{}'::jsonb`))
|
.addColumn('search_ext', 'jsonb', (col) => col.notNull().defaultTo(sql`'{}'::jsonb`))
|
||||||
|
|
@ -19,7 +19,7 @@ export async function up(db: Kysely<any>): Promise<void> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.dropIndex('nostr_events_search_ext_idx')
|
.dropIndex('nostr_events_search_ext_idx')
|
||||||
.on('nostr_events')
|
.on('nostr_events')
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('nostr_events').dropColumn('language').execute();
|
await db.schema.alterTable('nostr_events').dropColumn('language').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('nostr_events').addColumn('language', 'char(2)').execute();
|
await db.schema.alterTable('nostr_events').addColumn('language', 'char(2)').execute();
|
||||||
|
|
||||||
await db.schema.createIndex('nostr_events_language_created_idx')
|
await db.schema.createIndex('nostr_events_language_created_idx')
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.alterTable('nostr_events').alterColumn('search_ext', (col) => col.dropDefault()).execute();
|
await db.schema.alterTable('nostr_events').alterColumn('search_ext', (col) => col.dropDefault()).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> {
|
export async function down(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.alterTable('nostr_events')
|
.alterTable('nostr_events')
|
||||||
.alterColumn('search_ext', (col) => col.setDefault("'{}'::jsonb"))
|
.alterColumn('search_ext', (col) => col.setDefault("'{}'::jsonb"))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<unknown>): Promise<void> {
|
||||||
await db.schema.dropTable('pubkey_domains').execute();
|
await db.schema.dropTable('pubkey_domains').execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Kysely, sql } from 'kysely';
|
import { Kysely, sql } from 'kysely';
|
||||||
|
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await db.schema
|
await db.schema
|
||||||
.createView('top_authors')
|
.createView('top_authors')
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,7 @@ class EventsDB extends NPostgres {
|
||||||
override async count(
|
override async count(
|
||||||
filters: NostrFilter[],
|
filters: NostrFilter[],
|
||||||
opts: { signal?: AbortSignal; timeout?: number } = {},
|
opts: { signal?: AbortSignal; timeout?: number } = {},
|
||||||
): Promise<{ count: number; approximate: any }> {
|
): Promise<{ count: number; approximate: boolean }> {
|
||||||
if (opts.signal?.aborted) return Promise.reject(abortError());
|
if (opts.signal?.aborted) return Promise.reject(abortError());
|
||||||
|
|
||||||
logi({ level: 'debug', ns: 'ditto.count', source: 'db', filters: filters as JsonValue });
|
logi({ level: 'debug', ns: 'ditto.count', source: 'db', filters: filters as JsonValue });
|
||||||
|
|
@ -428,6 +428,7 @@ class EventsDB extends NPostgres {
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
override async transaction(callback: (store: NPostgres, kysely: Kysely<any>) => Promise<void>): Promise<void> {
|
override async transaction(callback: (store: NPostgres, kysely: Kysely<any>) => Promise<void>): Promise<void> {
|
||||||
return super.transaction((store, kysely) => callback(store, kysely as unknown as Kysely<DittoTables>));
|
return super.transaction((store, kysely) => callback(store, kysely as unknown as Kysely<DittoTables>));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,12 @@ export function parseFormData(formData: FormData): unknown {
|
||||||
/** Deeply sets a value in an object based on a Rails-style nested key. */
|
/** Deeply sets a value in an object based on a Rails-style nested key. */
|
||||||
function deepSet(
|
function deepSet(
|
||||||
/** The target object to modify. */
|
/** The target object to modify. */
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
target: Record<string, any>,
|
target: Record<string, any>,
|
||||||
/** The Rails-style key (e.g., "fields_attributes[0][name]"). */
|
/** The Rails-style key (e.g., "fields_attributes[0][name]"). */
|
||||||
key: string,
|
key: string,
|
||||||
/** The value to set. */
|
/** The value to set. */
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
value: any,
|
value: any,
|
||||||
): void {
|
): void {
|
||||||
const keys = key.match(/[^[\]]+/g); // Extract keys like ["fields_attributes", "0", "name"]
|
const keys = key.match(/[^[\]]+/g); // Extract keys like ["fields_attributes", "0", "name"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue