2024-08-25 17:36:25 +02:00
|
|
|
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
2024-08-25 10:09:57 +02:00
|
|
|
|
|
|
|
export class RefreshPrimaryChange1724573307851 implements MigrationInterface {
|
2024-08-25 17:36:25 +02:00
|
|
|
name = "RefreshPrimaryChange1724573307851";
|
2024-08-25 10:09:57 +02:00
|
|
|
|
2024-08-25 17:36:25 +02:00
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
await queryRunner.dropColumn("refresh", "id");
|
|
|
|
await queryRunner.createPrimaryKey("refresh", ["token", "userId"]);
|
|
|
|
}
|
2024-08-25 10:09:57 +02:00
|
|
|
|
2024-08-25 17:36:25 +02:00
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
await queryRunner.dropPrimaryKey("refresh");
|
|
|
|
await queryRunner.addColumn(
|
|
|
|
"refresh",
|
|
|
|
new TableColumn({
|
|
|
|
name: "id",
|
|
|
|
type: "int",
|
|
|
|
isPrimary: true,
|
|
|
|
isNullable: false,
|
|
|
|
isGenerated: true,
|
|
|
|
generationStrategy: "increment",
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2024-08-25 10:09:57 +02:00
|
|
|
}
|