-
Notifications
You must be signed in to change notification settings - Fork 369
Closed
Labels
Description
When I set custom key to a model, and make a hasMany relationship, the underlying table is incorrect. tried with version (excerpt from package.json -> "orm": "~2.1.10")
var Email = persistence.define('email', {
id: {type: 'text', key: true},
bounced: Boolean,
last_checked: Date,
});
var Account = persistence.define('account', {
name: String
});
Account.hasMany('email', Email); // or
Email.hasMany('account', Account);I get these DDL commands for base tables
[SQL/postgres] CREATE TABLE "email" ("id" TEXT, "bounced" BOOLEAN, "last_checked" DATE, PRIMARY KEY ("id"))
[SQL/postgres] CREATE TABLE "account" ("name" TEXT, "id" SERIAL, "parent_id" INTEGER, "account_type_id" INTEGER, PRIMARY KEY ("id"))
and many to many table
[SQL/postgres] CREATE TABLE "account_email" ("account_id" TEXT, "email_id" INTEGER, PRIMARY KEY ("account_id"))
Two observations which I noticed is, that it reverses the datatype, and only one is primary key, both should be primary keys... no matter what datatype.
Reactions are currently unavailable