Merge pull request '6372-ExpenseManual-Error' (!2072) from 6372-ExpenseManual-Error into dev
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
Reviewed-on: #2072 Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
This commit is contained in:
commit
ba167d52ef
|
@ -1,24 +1,33 @@
|
|||
ALTER TABLE IF EXISTS vn2008.gastos_resumen DROP FOREIGN KEY IF EXISTS gastos_resumen_expense_FK;
|
||||
ALTER TABLE IF EXISTS `vn2008`.`gastos_resumen` RENAME `vn`.`expenseManual`;
|
||||
|
||||
ALTER TABLE IF EXISTS `vn`.`expenseManual`
|
||||
ALTER TABLE `vn`.`expenseManual`
|
||||
CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) NOT NULL,
|
||||
CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) DEFAULT NULL,
|
||||
CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(11) NOT NULL;
|
||||
|
||||
ALTER TABLE IF EXISTS vn.expenseManual COLLATE=utf8mb3_general_ci;
|
||||
ALTER TABLE vn.expenseManual COLLATE=utf8mb3_general_ci;
|
||||
|
||||
ALTER TABLE IF EXISTS vn.expenseManual MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;
|
||||
ALTER TABLE vn.expenseManual MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;
|
||||
|
||||
ALTER TABLE IF EXISTS vn.expenseManual ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE IF EXISTS vn.expenseManual MODIFY COLUMN IF EXISTS companyFk int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.expenseManual DROP PRIMARY KEY;
|
||||
|
||||
ALTER TABLE vn.expenseManual MODIFY COLUMN companyFk int(10) unsigned NULL;
|
||||
|
||||
ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE vn.expenseManual ADD IF NOT EXISTS id INT unsigned NOT NULL FIRST;
|
||||
|
||||
ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_pk PRIMARY KEY IF NOT EXISTS (id);
|
||||
|
||||
ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_unique UNIQUE KEY IF NOT EXISTS (expenseFk,`year`,`month`,companyFk);
|
||||
|
||||
ALTER TABLE vn.expenseManual MODIFY COLUMN IF EXISTS companyFk int(10) unsigned NOT NULL;
|
||||
|
||||
UPDATE vn.expenseManual
|
||||
SET companyFK= NULL
|
||||
WHERE companyFk= 0;
|
||||
|
||||
ALTER TABLE IF EXISTS vn.expenseManual ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue