-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 fix posts_links FK constraint, add reusable block tombstones
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
db/migration/1701280181658-FixPostLinksForeingKeyDeleteClause.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm" | ||
|
||
export class FixPostLinksForeingKeyDeleteClause1701280181658 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
ALTER TABLE posts_links | ||
DROP FOREIGN KEY posts_links_ibfk_1; | ||
`) | ||
await queryRunner.query(` | ||
ALTER TABLE posts_links | ||
ADD CONSTRAINT posts_links_ibfk_1 | ||
FOREIGN KEY (sourceId) | ||
REFERENCES posts(id) | ||
ON UPDATE CASCADE | ||
ON DELETE CASCADE; | ||
`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> {} | ||
Check warning on line 21 in db/migration/1701280181658-FixPostLinksForeingKeyDeleteClause.ts GitHub Actions / eslint
Check warning on line 21 in db/migration/1701280181658-FixPostLinksForeingKeyDeleteClause.ts GitHub Actions / eslint
Check warning on line 21 in db/migration/1701280181658-FixPostLinksForeingKeyDeleteClause.ts GitHub Actions / eslint
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters