-- Copyright (C) 2022 SuperAdmin
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see https://www.gnu.org/licenses/.


-- BEGIN MODULEBUILDER INDEXES
ALTER TABLE llx_gpaoplus_chrono_time ADD INDEX idx_gpaoplus_chrono_time_rowid (rowid);
-- END MODULEBUILDER INDEXES

ALTER TABLE llx_gpaoplus_chrono_time ADD UNIQUE INDEX uk_chrono_time_user_moline(fk_user, fk_mo_line);
ALTER TABLE llx_gpaoplus_chrono_time ADD CONSTRAINT llx_gpaoplus_chrono_time_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid);

--TODO : Trigger : supression des données de cette ligne (dans cette table) sur suppression de la ligne
ALTER TABLE llx_gpaoplus_chrono_time ADD CONSTRAINT llx_gpaoplus_chrono_time_fk_mo_line FOREIGN KEY (fk_mo_line) REFERENCES llx_mrp_production(rowid);

