How to create laravel migration for tables with multiple foreign keys?
I want to create a table with multiple foreign keys. Here is the sql:
CREATE TABLE `customers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`type_id` tinyint(3) unsigned DEFAULT NULL,
`district_id` tinyint(3) unsigned DEFAULT NULL,
`city_id` tinyint(3) unsigned DEFAULT NULL,
`business_id` tinyint(3) unsigned DEFAULT NULL,
`group_id` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_customer_1` (`district_id`,`city_id`),
KEY `FK_customer_2` (`business_id`),
KEY `FK_customer_3` (`group_id`),
KEY `FK_customer_4` (`type_id`),
CONSTRAINT `FK_customer_1` FOREIGN KEY (`district_id`, `city_id`)
REFERENCES `cities` (`district_id`, `city_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_2` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_3` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_4` FOREIGN KEY (`type_id`) REFERENCES `types` (`type_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
I wrote a migration file with the following:
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign(['district_id','city_id'])->references(['district_id','city_id'])->on('cities')->onDelete('cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
But when I run the migration it gives me the following error.
SQLSTATE[HY000]: General error: 1005 Can't create table `wastewater`.`#sql-5a8_18a` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `customers` add constraint `customers_district_id_city_id_foreign` foreign key (`district_id`, `city_id`) references `cities` (`district_id`, `city_id`) on delete cascade)`
How can I this?
laravel-5
add a comment |
I want to create a table with multiple foreign keys. Here is the sql:
CREATE TABLE `customers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`type_id` tinyint(3) unsigned DEFAULT NULL,
`district_id` tinyint(3) unsigned DEFAULT NULL,
`city_id` tinyint(3) unsigned DEFAULT NULL,
`business_id` tinyint(3) unsigned DEFAULT NULL,
`group_id` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_customer_1` (`district_id`,`city_id`),
KEY `FK_customer_2` (`business_id`),
KEY `FK_customer_3` (`group_id`),
KEY `FK_customer_4` (`type_id`),
CONSTRAINT `FK_customer_1` FOREIGN KEY (`district_id`, `city_id`)
REFERENCES `cities` (`district_id`, `city_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_2` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_3` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_4` FOREIGN KEY (`type_id`) REFERENCES `types` (`type_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
I wrote a migration file with the following:
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign(['district_id','city_id'])->references(['district_id','city_id'])->on('cities')->onDelete('cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
But when I run the migration it gives me the following error.
SQLSTATE[HY000]: General error: 1005 Can't create table `wastewater`.`#sql-5a8_18a` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `customers` add constraint `customers_district_id_city_id_foreign` foreign key (`district_id`, `city_id`) references `cities` (`district_id`, `city_id`) on delete cascade)`
How can I this?
laravel-5
add a comment |
I want to create a table with multiple foreign keys. Here is the sql:
CREATE TABLE `customers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`type_id` tinyint(3) unsigned DEFAULT NULL,
`district_id` tinyint(3) unsigned DEFAULT NULL,
`city_id` tinyint(3) unsigned DEFAULT NULL,
`business_id` tinyint(3) unsigned DEFAULT NULL,
`group_id` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_customer_1` (`district_id`,`city_id`),
KEY `FK_customer_2` (`business_id`),
KEY `FK_customer_3` (`group_id`),
KEY `FK_customer_4` (`type_id`),
CONSTRAINT `FK_customer_1` FOREIGN KEY (`district_id`, `city_id`)
REFERENCES `cities` (`district_id`, `city_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_2` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_3` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_4` FOREIGN KEY (`type_id`) REFERENCES `types` (`type_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
I wrote a migration file with the following:
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign(['district_id','city_id'])->references(['district_id','city_id'])->on('cities')->onDelete('cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
But when I run the migration it gives me the following error.
SQLSTATE[HY000]: General error: 1005 Can't create table `wastewater`.`#sql-5a8_18a` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `customers` add constraint `customers_district_id_city_id_foreign` foreign key (`district_id`, `city_id`) references `cities` (`district_id`, `city_id`) on delete cascade)`
How can I this?
laravel-5
I want to create a table with multiple foreign keys. Here is the sql:
CREATE TABLE `customers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`type_id` tinyint(3) unsigned DEFAULT NULL,
`district_id` tinyint(3) unsigned DEFAULT NULL,
`city_id` tinyint(3) unsigned DEFAULT NULL,
`business_id` tinyint(3) unsigned DEFAULT NULL,
`group_id` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_customer_1` (`district_id`,`city_id`),
KEY `FK_customer_2` (`business_id`),
KEY `FK_customer_3` (`group_id`),
KEY `FK_customer_4` (`type_id`),
CONSTRAINT `FK_customer_1` FOREIGN KEY (`district_id`, `city_id`)
REFERENCES `cities` (`district_id`, `city_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_2` FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_3` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE,
CONSTRAINT `FK_customer_4` FOREIGN KEY (`type_id`) REFERENCES `types` (`type_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
I wrote a migration file with the following:
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign(['district_id','city_id'])->references(['district_id','city_id'])->on('cities')->onDelete('cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
But when I run the migration it gives me the following error.
SQLSTATE[HY000]: General error: 1005 Can't create table `wastewater`.`#sql-5a8_18a` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `customers` add constraint `customers_district_id_city_id_foreign` foreign key (`district_id`, `city_id`) references `cities` (`district_id`, `city_id`) on delete cascade)`
How can I this?
laravel-5
laravel-5
edited Nov 23 '18 at 7:59
DestinatioN
1,2581326
1,2581326
asked Nov 23 '18 at 2:47
Abaij
3272722
3272722
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Can you please Try this way, Just removed array and define with comma-separated only.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign('district_id','city_id')->references('district_id','city_id')->on('cities','cities')->onDelete('cascade','cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
no, I think that's not the case. The second argument will create index name, not a key.
– Abaij
Nov 23 '18 at 9:36
add a comment |
Try the following way, it will work.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->integer('type_id', false, true);
$table->foreign('type_id')->references('type_id')->on('types')
->onDelete('cascade');
$table->integer('district_id', false, true);
$table->foreign('district_id')
->references('district_id')->on('cities')
->onDelete('cascade');
$table->integer('city_id', false, true);
$table->foreign('city_id')
->references('city_id')->on('cities')
->onDelete('cascade');
$table->integer('business_id', false, true);
$table->foreign('business_id')->references('business_id')
->on('businesses')->onDelete('cascade');
$table->integer('group_id', false, true);
$table->foreign('group_id')->references('group_id')->on('groups')
->onDelete('cascade');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->timestamps();
});
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440088%2fhow-to-create-laravel-migration-for-tables-with-multiple-foreign-keys%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Can you please Try this way, Just removed array and define with comma-separated only.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign('district_id','city_id')->references('district_id','city_id')->on('cities','cities')->onDelete('cascade','cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
no, I think that's not the case. The second argument will create index name, not a key.
– Abaij
Nov 23 '18 at 9:36
add a comment |
Can you please Try this way, Just removed array and define with comma-separated only.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign('district_id','city_id')->references('district_id','city_id')->on('cities','cities')->onDelete('cascade','cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
no, I think that's not the case. The second argument will create index name, not a key.
– Abaij
Nov 23 '18 at 9:36
add a comment |
Can you please Try this way, Just removed array and define with comma-separated only.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign('district_id','city_id')->references('district_id','city_id')->on('cities','cities')->onDelete('cascade','cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
Can you please Try this way, Just removed array and define with comma-separated only.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->integer('type_id')->unsigned()->index();
$table->integer('district_id')->unsigned()->index();
$table->integer('city_id')->unsigned()->index();
$table->integer('business_id')->unsigned()->index();
$table->integer('group_id')->unsigned()->index();
$table->timestamps();
$table->foreign('district_id','city_id')->references('district_id','city_id')->on('cities','cities')->onDelete('cascade','cascade');
$table->foreign('business_id')->references('business_id')->on('businesses')->onDelete('cascade');
$table->foreign('type_id')->references('type_id')->on('types')->onDelete('cascade');
$table->foreign('group_id')->references('group_id')->on('groups')->onDelete('cascade');
});
edited Nov 23 '18 at 6:39
DestinatioN
1,2581326
1,2581326
answered Nov 23 '18 at 6:29
Mayank Majithya
1,014314
1,014314
no, I think that's not the case. The second argument will create index name, not a key.
– Abaij
Nov 23 '18 at 9:36
add a comment |
no, I think that's not the case. The second argument will create index name, not a key.
– Abaij
Nov 23 '18 at 9:36
no, I think that's not the case. The second argument will create index name, not a key.
– Abaij
Nov 23 '18 at 9:36
no, I think that's not the case. The second argument will create index name, not a key.
– Abaij
Nov 23 '18 at 9:36
add a comment |
Try the following way, it will work.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->integer('type_id', false, true);
$table->foreign('type_id')->references('type_id')->on('types')
->onDelete('cascade');
$table->integer('district_id', false, true);
$table->foreign('district_id')
->references('district_id')->on('cities')
->onDelete('cascade');
$table->integer('city_id', false, true);
$table->foreign('city_id')
->references('city_id')->on('cities')
->onDelete('cascade');
$table->integer('business_id', false, true);
$table->foreign('business_id')->references('business_id')
->on('businesses')->onDelete('cascade');
$table->integer('group_id', false, true);
$table->foreign('group_id')->references('group_id')->on('groups')
->onDelete('cascade');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->timestamps();
});
add a comment |
Try the following way, it will work.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->integer('type_id', false, true);
$table->foreign('type_id')->references('type_id')->on('types')
->onDelete('cascade');
$table->integer('district_id', false, true);
$table->foreign('district_id')
->references('district_id')->on('cities')
->onDelete('cascade');
$table->integer('city_id', false, true);
$table->foreign('city_id')
->references('city_id')->on('cities')
->onDelete('cascade');
$table->integer('business_id', false, true);
$table->foreign('business_id')->references('business_id')
->on('businesses')->onDelete('cascade');
$table->integer('group_id', false, true);
$table->foreign('group_id')->references('group_id')->on('groups')
->onDelete('cascade');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->timestamps();
});
add a comment |
Try the following way, it will work.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->integer('type_id', false, true);
$table->foreign('type_id')->references('type_id')->on('types')
->onDelete('cascade');
$table->integer('district_id', false, true);
$table->foreign('district_id')
->references('district_id')->on('cities')
->onDelete('cascade');
$table->integer('city_id', false, true);
$table->foreign('city_id')
->references('city_id')->on('cities')
->onDelete('cascade');
$table->integer('business_id', false, true);
$table->foreign('business_id')->references('business_id')
->on('businesses')->onDelete('cascade');
$table->integer('group_id', false, true);
$table->foreign('group_id')->references('group_id')->on('groups')
->onDelete('cascade');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->timestamps();
});
Try the following way, it will work.
Schema::create('customers', function (Blueprint $table) {
$table->increments('id');
$table->integer('type_id', false, true);
$table->foreign('type_id')->references('type_id')->on('types')
->onDelete('cascade');
$table->integer('district_id', false, true);
$table->foreign('district_id')
->references('district_id')->on('cities')
->onDelete('cascade');
$table->integer('city_id', false, true);
$table->foreign('city_id')
->references('city_id')->on('cities')
->onDelete('cascade');
$table->integer('business_id', false, true);
$table->foreign('business_id')->references('business_id')
->on('businesses')->onDelete('cascade');
$table->integer('group_id', false, true);
$table->foreign('group_id')->references('group_id')->on('groups')
->onDelete('cascade');
$table->string('name',50);
$table->string('address',100)->nullable();
$table->string('email',50)->nullable();
$table->timestamps();
});
answered Nov 23 '18 at 9:19
engrhussainahmad
1258
1258
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440088%2fhow-to-create-laravel-migration-for-tables-with-multiple-foreign-keys%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown