denodb icon indicating copy to clipboard operation
denodb copied to clipboard

Postgres Foreign Key is created with integer type by default

Open klima18 opened this issue 2 years ago • 2 comments

Hello guys!

I have two tables with column id uuid type, but when I create a relationship between them, denodb create the foreign key with integer type by default. I believe that the corret way to do that is using the column id type of the first table right?

klima18 avatar Nov 19 '22 19:11 klima18

I think I had the same problem. I solved removing unique prop

export class User extends Model {
  static table = 'users';

  static timestamps = true;

  static fields: ModelFields = {
    id: {
      type: DataTypes.UUID,
      primaryKey: true,
      // unique: true
    },
    // ...rest of the fields
  }
}

marcotterra avatar Dec 08 '22 13:12 marcotterra

Huuummm but I dont use unique prop in my models. Just primaryKey prop. I was reading the code and I saw that the relationship configuration its was using integer by default.

klima18 avatar Dec 08 '22 22:12 klima18