Allow ON DELETE CASCADE for receiving_id foreign key in links table

This commit is contained in:
objecttothis
2020-08-19 12:17:18 +04:00
committed by jekkos
parent 3e4e6af726
commit b9727d72d7
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Migration_modify_attr_links_constraint extends CI_Migration
{
public function __construct()
{
parent::__construct();
}
public function up()
{
error_log('Migrating modify_attr_links_constraint');
execute_script(APPPATH . 'migrations/sqlscripts/3.3.2_modify_attr_links_constraint.sql');
error_log('Migrating modify_attr_links_constraint');
}
public function down()
{
}
}
?>

View File

@@ -0,0 +1,8 @@
ALTER TABLE `ospos_attribute_links`
DROP FOREIGN KEY `ospos_attribute_links_ibfk_4`;
ALTER TABLE `ospos_attribute_links`
ADD CONSTRAINT `ospos_attribute_links_ibfk_4`
FOREIGN KEY (`receiving_id`) REFERENCES `ospos_receivings`(`receiving_id`)
ON DELETE CASCADE
ON UPDATE RESTRICT;