Closed holiday-jan closed 5 months ago
Thank you for the bug report. That's a very specific bug. I'll look into it.
Hi,
Maybe this is a suitable solution, if you change the function insertDefaultData() in the Install.php script to:
protected function insertDefaultData()
{
$firstForm = new \wheelform\db\Form();
$firstForm->site_id = Craft::$app->sites->currentSite->id;
$firstForm->name = 'Contact Form';
$firstForm->to_email = "user@example.com";
$firstForm->active = 1;
$firstForm->send_email = 1;
$firstForm->recaptcha = 0;
if ($firstForm->save()) {
$this->insert(
'{{%wheelform_form_fields}}',
[
"form_id" => $firstForm->id,
"type" => 'email',
"name" => "email",
"order" => 1,
"required" => 1,
]
);
$this->insert(
'{{%wheelform_form_fields}}',
[
"form_id" => $firstForm->id,
"type" => 'text',
"name" => "name",
"order" => 2,
"required" => 0,
]
);
$this->insert(
'{{%wheelform_form_fields}}',
[
"form_id" => $firstForm->id,
"type" => 'text',
"name" => "message",
"order" => 3,
"required" => 1,
]
);
}
}
!! Untested, only as example !!
Hope this will help you in a good and solid solution. We love your plugin, thank you for your time again!
Beste regards, Jan
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I tested my suggested solution: https://github.com/xpertbot/craft-wheelform/issues/301#issuecomment-1889414754, and it works prefectly both ways (normal DB-setup and our cluster setup). Can you please take another look into this. It would realy help us forward. Best regards, Jan
I'll take another look and deploy a fix if appropriate.
Any progress on this?
I tested the code above both ways, and it works as expected. So if you please could consider a fix, it would helps us in the future with new projects.
Hi!
During the
./craft plugin/install
process, we receive the following issue:Extra information: our DB-setup is on a galera-cluster and, the first "auto ID" for the initial
insert
was 3, instead of the expacted 1. So the secondinsert
, where theform_id
value is set to 1, fails the constraint.Hope this imformation helps you to make the install process smoother.
Best regards, Jan