mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-29 01:28:59 -05:00
fix: database migration by adding a username
This commit is contained in:
parent
6b0b979414
commit
e9526fc039
3 changed files with 10 additions and 1 deletions
|
@ -28,7 +28,7 @@ CREATE TABLE "new_User" (
|
|||
"password" TEXT NOT NULL,
|
||||
"isAdmin" BOOLEAN NOT NULL DEFAULT false
|
||||
);
|
||||
INSERT INTO "new_User" ("createdAt", "email", "id", "password", "updatedAt") SELECT "createdAt", "email", "id", "password", "updatedAt" FROM "User";
|
||||
INSERT INTO "new_User" ("createdAt", "email", "id", "password", "updatedAt", "username") SELECT "createdAt", "email", "id", "password", "updatedAt", 'user-' || User.id as "username" FROM "User";
|
||||
DROP TABLE "User";
|
||||
ALTER TABLE "new_User" RENAME TO "User";
|
||||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
|
||||
|
|
|
@ -12,6 +12,7 @@ import { EmailModule } from "./email/email.module";
|
|||
import { FileModule } from "./file/file.module";
|
||||
import { PrismaModule } from "./prisma/prisma.module";
|
||||
import { ShareModule } from "./share/share.module";
|
||||
import { UserModule } from "./user/user.module";
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
@ -21,6 +22,7 @@ import { ShareModule } from "./share/share.module";
|
|||
EmailModule,
|
||||
PrismaModule,
|
||||
ConfigModule,
|
||||
UserModule,
|
||||
MulterModule.registerAsync({
|
||||
useFactory: (config: ConfigService) => ({
|
||||
fileFilter: (req: Request, file, cb) => {
|
||||
|
|
7
backend/src/user/user.module.ts
Normal file
7
backend/src/user/user.module.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { Module } from "@nestjs/common";
|
||||
import { UserController } from "./user.controller";
|
||||
|
||||
@Module({
|
||||
controllers: [UserController],
|
||||
})
|
||||
export class UserModule {}
|
Loading…
Add table
Reference in a new issue