diff --git a/packages/bsky/bin/migration-create.ts b/packages/bsky/bin/migration-create.ts index b51c536c4f2..27edc5e0979 100644 --- a/packages/bsky/bin/migration-create.ts +++ b/packages/bsky/bin/migration-create.ts @@ -14,7 +14,15 @@ export async function main() { ) } const filename = `${prefix}-${name}` - const dir = path.join(__dirname, '..', 'src', 'db', 'migrations') + const dir = path.join( + __dirname, + '..', + 'src', + 'data-plane', + 'server', + 'db', + 'migrations', + ) await fs.writeFile(path.join(dir, `${filename}.ts`), template, { flag: 'wx' }) await fs.writeFile( diff --git a/packages/bsky/src/db/migrations/20231205T000257238Z-remove-did-cache.ts b/packages/bsky/src/db/migrations/20231205T000257238Z-remove-did-cache.ts deleted file mode 100644 index 6b57a88bbb9..00000000000 --- a/packages/bsky/src/db/migrations/20231205T000257238Z-remove-did-cache.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema.dropTable('did_cache').execute() -} - -export async function down(db: Kysely): Promise { - await db.schema - .createTable('did_cache') - .addColumn('did', 'varchar', (col) => col.primaryKey()) - .addColumn('doc', 'jsonb', (col) => col.notNull()) - .addColumn('updatedAt', 'bigint', (col) => col.notNull()) - .execute() -} diff --git a/packages/bsky/src/db/migrations/20231220T225126090Z-blob-takedowns.ts b/packages/bsky/src/db/migrations/20231220T225126090Z-blob-takedowns.ts deleted file mode 100644 index ce8d03cae54..00000000000 --- a/packages/bsky/src/db/migrations/20231220T225126090Z-blob-takedowns.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Kysely } from 'kysely' - -export async function up(db: Kysely): Promise { - await db.schema - .createTable('blob_takedown') - .addColumn('did', 'varchar', (col) => col.notNull()) - .addColumn('cid', 'varchar', (col) => col.notNull()) - .addColumn('takedownRef', 'varchar', (col) => col.notNull()) - .addPrimaryKeyConstraint('blob_takedown_pkey', ['did', 'cid']) - .execute() - - await db.schema - .alterTable('actor') - .dropConstraint('actor_takedown_id_fkey') - .execute() - await db.schema.alterTable('actor').dropColumn('takedownId').execute() - await db.schema - .alterTable('actor') - .addColumn('takedownRef', 'varchar') - .execute() - - await db.schema - .alterTable('record') - .dropConstraint('record_takedown_id_fkey') - .execute() - await db.schema.alterTable('record').dropColumn('takedownId').execute() - await db.schema - .alterTable('record') - .addColumn('takedownRef', 'varchar') - .execute() -} - -export async function down(db: Kysely): Promise { - await db.schema.dropTable('blob_takedown').execute() - - await db.schema.alterTable('actor').dropColumn('takedownRef').execute() - await db.schema - .alterTable('actor') - .addColumn('takedownId', 'integer') - .execute() - - await db.schema - .alterTable('actor') - .addForeignKeyConstraint( - 'actor_takedown_id_fkey', - ['takedownId'], - 'moderation_event', - ['id'], - ) - .execute() - - await db.schema.alterTable('record').dropColumn('takedownRef').execute() - await db.schema - .alterTable('record') - .addColumn('takedownId', 'integer') - .execute() - await db.schema - .alterTable('record') - .addForeignKeyConstraint( - 'record_takedown_id_fkey', - ['takedownId'], - 'moderation_event', - ['id'], - ) - .execute() -} diff --git a/packages/bsky/src/db/tables/blob-takedown.ts b/packages/bsky/src/db/tables/blob-takedown.ts deleted file mode 100644 index 08ff80b1e0e..00000000000 --- a/packages/bsky/src/db/tables/blob-takedown.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface BlobTakedown { - did: string - cid: string - takedownRef: string -} - -export const tableName = 'blob_takedown' - -export type PartialDB = { [tableName]: BlobTakedown }