eveningkid / denodb

MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno

Home Page:https://eveningkid.com/denodb-docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Postgres Foreign Key is created with integer type by default

klima18 opened this issue · 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?

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
  }
}

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.