From a01ae9b7b8d35ea976c8510e25c47164274d0125 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 29 Jul 2024 14:09:55 +0200 Subject: [PATCH 1/2] fix: refs #7756 Foreign keys invoiceOut --- db/versions/11172-blueFern/00-firstScript.sql | 1 + db/versions/11172-blueFern/01-firstScript.sql | 1 + db/versions/11172-blueFern/02-firstScript.sql | 1 + db/versions/11172-blueFern/03-firstScript.sql | 1 + db/versions/11172-blueFern/04-firstScript.sql | 1 + db/versions/11172-blueFern/05-firstScript.sql | 1 + db/versions/11172-blueFern/06-firstScript.sql | 1 + db/versions/11172-blueFern/07-firstScript.sql | 1 + db/versions/11172-blueFern/08-firstScript.sql | 1 + db/versions/11172-blueFern/09-firstScript.sql | 1 + db/versions/11172-blueFern/10-firstScript.sql | 2 ++ db/versions/11172-blueFern/11-firstScript.sql | 2 ++ db/versions/11172-blueFern/12-firstScript.sql | 2 ++ db/versions/11172-blueFern/13-firstScript.sql | 2 ++ db/versions/11172-blueFern/14-firstScript.sql | 2 ++ 15 files changed, 20 insertions(+) create mode 100644 db/versions/11172-blueFern/00-firstScript.sql create mode 100644 db/versions/11172-blueFern/01-firstScript.sql create mode 100644 db/versions/11172-blueFern/02-firstScript.sql create mode 100644 db/versions/11172-blueFern/03-firstScript.sql create mode 100644 db/versions/11172-blueFern/04-firstScript.sql create mode 100644 db/versions/11172-blueFern/05-firstScript.sql create mode 100644 db/versions/11172-blueFern/06-firstScript.sql create mode 100644 db/versions/11172-blueFern/07-firstScript.sql create mode 100644 db/versions/11172-blueFern/08-firstScript.sql create mode 100644 db/versions/11172-blueFern/09-firstScript.sql create mode 100644 db/versions/11172-blueFern/10-firstScript.sql create mode 100644 db/versions/11172-blueFern/11-firstScript.sql create mode 100644 db/versions/11172-blueFern/12-firstScript.sql create mode 100644 db/versions/11172-blueFern/13-firstScript.sql create mode 100644 db/versions/11172-blueFern/14-firstScript.sql diff --git a/db/versions/11172-blueFern/00-firstScript.sql b/db/versions/11172-blueFern/00-firstScript.sql new file mode 100644 index 000000000..04e0813d5 --- /dev/null +++ b/db/versions/11172-blueFern/00-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.ticket DROP FOREIGN KEY ticket_FK; \ No newline at end of file diff --git a/db/versions/11172-blueFern/01-firstScript.sql b/db/versions/11172-blueFern/01-firstScript.sql new file mode 100644 index 000000000..64255f9de --- /dev/null +++ b/db/versions/11172-blueFern/01-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceOut DROP KEY Id_Factura; diff --git a/db/versions/11172-blueFern/02-firstScript.sql b/db/versions/11172-blueFern/02-firstScript.sql new file mode 100644 index 000000000..e76b7f7d6 --- /dev/null +++ b/db/versions/11172-blueFern/02-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceOut MODIFY COLUMN id int(10) unsigned NOT NULL; \ No newline at end of file diff --git a/db/versions/11172-blueFern/03-firstScript.sql b/db/versions/11172-blueFern/03-firstScript.sql new file mode 100644 index 000000000..e6def98a4 --- /dev/null +++ b/db/versions/11172-blueFern/03-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceCorrection DROP FOREIGN KEY corrected_fk; diff --git a/db/versions/11172-blueFern/04-firstScript.sql b/db/versions/11172-blueFern/04-firstScript.sql new file mode 100644 index 000000000..a19bc336e --- /dev/null +++ b/db/versions/11172-blueFern/04-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceCorrection DROP FOREIGN KEY correcting_fk; diff --git a/db/versions/11172-blueFern/05-firstScript.sql b/db/versions/11172-blueFern/05-firstScript.sql new file mode 100644 index 000000000..9f5ec2871 --- /dev/null +++ b/db/versions/11172-blueFern/05-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceOutExpense DROP FOREIGN KEY invoiceOutExpence_FK_1; diff --git a/db/versions/11172-blueFern/06-firstScript.sql b/db/versions/11172-blueFern/06-firstScript.sql new file mode 100644 index 000000000..2c16e9b77 --- /dev/null +++ b/db/versions/11172-blueFern/06-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceOutTax DROP FOREIGN KEY invoiceOutFk; diff --git a/db/versions/11172-blueFern/07-firstScript.sql b/db/versions/11172-blueFern/07-firstScript.sql new file mode 100644 index 000000000..bec72a131 --- /dev/null +++ b/db/versions/11172-blueFern/07-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceOut DROP PRIMARY KEY; diff --git a/db/versions/11172-blueFern/08-firstScript.sql b/db/versions/11172-blueFern/08-firstScript.sql new file mode 100644 index 000000000..316db2e32 --- /dev/null +++ b/db/versions/11172-blueFern/08-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceOut ADD CONSTRAINT invoiceOut_pk PRIMARY KEY (id); diff --git a/db/versions/11172-blueFern/09-firstScript.sql b/db/versions/11172-blueFern/09-firstScript.sql new file mode 100644 index 000000000..553d7857e --- /dev/null +++ b/db/versions/11172-blueFern/09-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceOut ADD CONSTRAINT invoiceOut_unique UNIQUE KEY (`ref`); diff --git a/db/versions/11172-blueFern/10-firstScript.sql b/db/versions/11172-blueFern/10-firstScript.sql new file mode 100644 index 000000000..e1847a877 --- /dev/null +++ b/db/versions/11172-blueFern/10-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.ticket ADD CONSTRAINT ticket_invoiceOut_FK + FOREIGN KEY (refFk) REFERENCES vn.invoiceOut(`ref`) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/11172-blueFern/11-firstScript.sql b/db/versions/11172-blueFern/11-firstScript.sql new file mode 100644 index 000000000..720b7962e --- /dev/null +++ b/db/versions/11172-blueFern/11-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.invoiceCorrection ADD CONSTRAINT invoiceCorrection_invoiceOut_FK + FOREIGN KEY (correctingFk) REFERENCES vn.invoiceOut(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/versions/11172-blueFern/12-firstScript.sql b/db/versions/11172-blueFern/12-firstScript.sql new file mode 100644 index 000000000..35099bd5d --- /dev/null +++ b/db/versions/11172-blueFern/12-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.invoiceCorrection ADD CONSTRAINT invoiceCorrection_invoiceOut_FK_1 + FOREIGN KEY (correctedFk) REFERENCES vn.invoiceOut(id) ON DELETE CASCADE ON UPDATE CASCADE; \ No newline at end of file diff --git a/db/versions/11172-blueFern/13-firstScript.sql b/db/versions/11172-blueFern/13-firstScript.sql new file mode 100644 index 000000000..f1aa0a216 --- /dev/null +++ b/db/versions/11172-blueFern/13-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.invoiceOutExpense ADD CONSTRAINT invoiceOutExpense_invoiceOut_FK + FOREIGN KEY (invoiceOutFk) REFERENCES vn.invoiceOut(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/versions/11172-blueFern/14-firstScript.sql b/db/versions/11172-blueFern/14-firstScript.sql new file mode 100644 index 000000000..ba570e20c --- /dev/null +++ b/db/versions/11172-blueFern/14-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.invoiceOutTax ADD CONSTRAINT invoiceOutTax_invoiceOut_FK + FOREIGN KEY (invoiceOutFk) REFERENCES vn.invoiceOut(id) ON DELETE CASCADE ON UPDATE CASCADE; From fc1767cab4e8c832ee1e2baadb0b17e00a77dc79 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 20 Aug 2024 08:45:04 +0200 Subject: [PATCH 2/2] refactor: refs #7756 Fix tests --- db/versions/11172-blueFern/15-firstScript.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/versions/11172-blueFern/15-firstScript.sql diff --git a/db/versions/11172-blueFern/15-firstScript.sql b/db/versions/11172-blueFern/15-firstScript.sql new file mode 100644 index 000000000..5d34f1025 --- /dev/null +++ b/db/versions/11172-blueFern/15-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.invoiceOut MODIFY COLUMN id int(10) unsigned auto_increment NOT NULL; \ No newline at end of file