mirror of
https://github.com/movie-web/backend.git
synced 2025-09-13 16:53:25 +00:00
Update UserSettings primary key to text, to match user
This commit is contained in:
@@ -587,12 +587,12 @@
|
|||||||
"columns": {
|
"columns": {
|
||||||
"id": {
|
"id": {
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"type": "uuid",
|
"type": "text",
|
||||||
"unsigned": false,
|
"unsigned": false,
|
||||||
"autoincrement": false,
|
"autoincrement": false,
|
||||||
"primary": false,
|
"primary": false,
|
||||||
"nullable": false,
|
"nullable": false,
|
||||||
"mappedType": "uuid"
|
"mappedType": "text"
|
||||||
},
|
},
|
||||||
"application_theme": {
|
"application_theme": {
|
||||||
"name": "application_theme",
|
"name": "application_theme",
|
||||||
|
14
src/db/migrations/Migration20231122231620.ts
Normal file
14
src/db/migrations/Migration20231122231620.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { Migration } from '@mikro-orm/migrations';
|
||||||
|
|
||||||
|
export class Migration20231122231620 extends Migration {
|
||||||
|
|
||||||
|
async up(): Promise<void> {
|
||||||
|
this.addSql('alter table "user_settings" alter column "id" type text using ("id"::text);');
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(): Promise<void> {
|
||||||
|
this.addSql('alter table "user_settings" alter column "id" drop default;');
|
||||||
|
this.addSql('alter table "user_settings" alter column "id" type uuid using ("id"::text::uuid);');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,10 +1,9 @@
|
|||||||
import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
|
import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
|
||||||
import { randomUUID } from 'crypto';
|
|
||||||
|
|
||||||
@Entity({ tableName: 'user_settings' })
|
@Entity({ tableName: 'user_settings' })
|
||||||
export class UserSettings {
|
export class UserSettings {
|
||||||
@PrimaryKey({ name: 'id', type: 'uuid' })
|
@PrimaryKey({ name: 'id', type: 'text' })
|
||||||
id: string = randomUUID();
|
id!: string;
|
||||||
|
|
||||||
@Property({ name: 'application_theme', nullable: true })
|
@Property({ name: 'application_theme', nullable: true })
|
||||||
applicationTheme?: string | null;
|
applicationTheme?: string | null;
|
||||||
|
Reference in New Issue
Block a user