Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Foreign Key is created with integer type by default #369

Open
klima18 opened this issue Nov 19, 2022 · 2 comments
Open

Postgres Foreign Key is created with integer type by default #369

klima18 opened this issue Nov 19, 2022 · 2 comments

Comments

@klima18
Copy link

klima18 commented Nov 19, 2022

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?

@marcotterra
Copy link

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

@klima18
Copy link
Author

klima18 commented Dec 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants