migrations/Version20230615094141.php line 1

Open in your IDE?
  1. <?php
  2. /* @noinspection PhpUnused */
  3. declare(strict_types=1);
  4. namespace DoctrineMigrations;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8.  * Auto-generated Migration: Please modify to your needs!
  9.  */
  10. final class Version20230615094141 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return '';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         // this up() migration is auto-generated, please modify it to your needs
  19.         $this->addSql(
  20.             '
  21.                 CREATE TABLE workplace (
  22.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  23.                     created_by INT NOT NULL COMMENT \'Internal ID\',
  24.                     updated_by INT DEFAULT NULL COMMENT \'Internal ID\',
  25.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  26.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  27.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  28.                     name VARCHAR(225) NOT NULL COMMENT \'Name for the workplace\',
  29.                     description TEXT DEFAULT NULL COMMENT \'Description for the workplace\',
  30.                     building VARCHAR(225) DEFAULT NULL COMMENT \'Building where the workplace is located\',
  31.                     station VARCHAR(225) DEFAULT NULL COMMENT \'Station for the workplace\',
  32.                     group_name VARCHAR(225) DEFAULT NULL COMMENT \'Group name for the workplace\',
  33.                     component VARCHAR(225) DEFAULT NULL COMMENT \'Component for the workplace\',
  34.                     position VARCHAR(225) DEFAULT NULL COMMENT \'Position for the workplace\',
  35.                     notes TEXT DEFAULT NULL COMMENT \'Notes for the workplace\',
  36.                     condition_type VARCHAR(16) NOT NULL COMMENT \'Condition type for the workplace\',
  37.                     number_of_workstations INT NOT NULL COMMENT \'Number of workstations for the workplace\',
  38.                     updated INT DEFAULT NULL COMMENT \'Entity update date as UNIX timestamp\',
  39.                     INDEX IDX_D0FB92EEDE12AB56 (created_by),
  40.                     INDEX IDX_D0FB92EE16FE72E1 (updated_by),
  41.                     PRIMARY KEY(id)
  42.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
  43.             '
  44.         );
  45.         $this->addSql(
  46.             '
  47.                 CREATE TABLE workplace_screening (
  48.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  49.                     created_by INT NOT NULL COMMENT \'Internal ID\',
  50.                     updated_by INT DEFAULT NULL COMMENT \'Internal ID\',
  51.                     workplace_id INT NOT NULL COMMENT \'Internal ID\',
  52.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  53.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  54.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  55.                     name VARCHAR(225) DEFAULT NULL COMMENT \'Name for the screening\',
  56.                     screening_date DATETIME DEFAULT NULL COMMENT \'Date for the screening\',
  57.                     general_requirements_drivers_licence_b SMALLINT DEFAULT 0 NOT NULL
  58.                         COMMENT \'General requirements driver\'\'s licence B\',
  59.                     general_requirements_drivers_licence_c_ce SMALLINT DEFAULT 0 NOT NULL
  60.                         COMMENT \'General requirements driver\'\'s licence C/CE\',
  61.                     general_requirements_drivers_licence_floor_conveyors SMALLINT DEFAULT 0 NOT NULL
  62.                         COMMENT \'General requirements driver\'\'s licence floor conveyors\',
  63.                     workplace_has_crane_or_forklift_activities SMALLINT DEFAULT 0 NOT NULL 
  64.                         COMMENT \'Workplace has crane or forklift activities\',
  65.                     general_requirements_education TEXT DEFAULT NULL COMMENT \'General requirements education\',
  66.                     general_requirements_qualification_notes_from_request TEXT DEFAULT NULL
  67.                         COMMENT \'General requirements qualification notes from request\',
  68.                     general_requirements_seating_opportunity_available SMALLINT DEFAULT 0 NOT NULL
  69.                         COMMENT \'General requirements availability of seating opportunity\',
  70.                     general_requirements_seating_workplace SMALLINT DEFAULT 0 NOT NULL
  71.                         COMMENT \'General requirements 100 % seating workplace\',
  72.                     general_requirements_workplace_with_visible_colleagues SMALLINT DEFAULT 0 NOT NULL
  73.                         COMMENT \'General requirements visibility of colleagues at workplace\',
  74.                     notes TEXT DEFAULT NULL COMMENT \'Notes for the screening\',
  75.                     updated INT DEFAULT NULL COMMENT \'Entity update date as UNIX timestamp\',
  76.                     work_organization_normal_shift SMALLINT DEFAULT 0 NOT NULL
  77.                         COMMENT \'Work organization normal shift\',
  78.                     work_organization_alternation_shift_without_night SMALLINT DEFAULT 0 NOT NULL
  79.                         COMMENT \'Work organization alternation shift without night\',
  80.                     work_organization_alternation_shift_with_night SMALLINT DEFAULT 0 NOT NULL
  81.                         COMMENT \'Work organization alternation shift with night\',
  82.                     work_organization_permanent_night_shift SMALLINT DEFAULT 0 NOT NULL
  83.                         COMMENT \'Work organization permanent night shift\',
  84.                     work_organization_rigid_tact_binding SMALLINT DEFAULT 0 NOT NULL
  85.                         COMMENT \'Work organization rigid tact binding\',
  86.                     work_organization_driving_and_steering_activities SMALLINT DEFAULT 0 NOT NULL
  87.                         COMMENT \'Work organization driving and steering activities\',
  88.                     work_organization_forklift_activities SMALLINT DEFAULT 0 NOT NULL
  89.                         COMMENT \'Work organization forklift activities\',
  90.                     other_impacts_deployment_on_rotating_machines SMALLINT DEFAULT 0 NOT NULL
  91.                         COMMENT \'Other impacts deployment on rotating machines\',
  92.                     other_impacts_falling_hazard SMALLINT DEFAULT 0 NOT NULL COMMENT \'Other impacts falling hazard\',
  93.                     other_impacts_full_body_vibrations SMALLINT DEFAULT 0 NOT NULL
  94.                         COMMENT \'Other impacts full body vibrations\',
  95.                     other_impacts_right_hand_arm_vibrations SMALLINT DEFAULT 0 NOT NULL
  96.                         COMMENT \'Other impacts right hand arm vibrations\',
  97.                     other_impacts_left_hand_arm_vibrations SMALLINT DEFAULT 0 NOT NULL
  98.                         COMMENT \'Other impacts left hand arm vibrations\',
  99.                     other_impacts_electromagnetic_fields SMALLINT DEFAULT 0 NOT NULL
  100.                         COMMENT \'Other impacts electromagnetic fields\',
  101.                     other_impacts_heat SMALLINT DEFAULT 0 NOT NULL COMMENT \'Other impacts heat\',
  102.                     other_impacts_impairing_noise SMALLINT DEFAULT 0 NOT NULL COMMENT \'Other impacts impairing noise\',
  103.                     other_impacts_dangerous_noise SMALLINT DEFAULT 0 NOT NULL COMMENT \'Other impacts dangerous noise\',
  104.                     other_impacts_solvents_and_varnishes SMALLINT DEFAULT 0 NOT NULL
  105.                         COMMENT \'Other impacts solvents and varnishes\',
  106.                     other_impacts_gases_vapors_aerosol_dust_smoke SMALLINT DEFAULT 0 NOT NULL
  107.                         COMMENT \'Other impacts gases vapors aerosol dust smoke\',
  108.                     other_impacts_oil_fat_emulsions SMALLINT DEFAULT 0 NOT NULL
  109.                         COMMENT \'Other impacts oil fat emulsions\',
  110.                     other_impacts_wet_room_works SMALLINT DEFAULT 0 NOT NULL COMMENT \'Other impacts wet room works\',
  111.                     information_perception_visual_acuity_close SMALLINT DEFAULT 0 NOT NULL
  112.                         COMMENT \'Information perception visual acuity close\',
  113.                     information_perception_visual_acuity_far SMALLINT DEFAULT 0 NOT NULL
  114.                         COMMENT \'Information perception visual acuity far\',
  115.                     information_perception_spatial_vision SMALLINT DEFAULT 0 NOT NULL
  116.                         COMMENT \'Information perception spatial vision\',
  117.                     information_perception_color_vision SMALLINT DEFAULT 0 NOT NULL
  118.                         COMMENT \'Information perception color vision\',
  119.                     information_perception_sound_or_speech_recognition SMALLINT DEFAULT 0 NOT NULL
  120.                         COMMENT \'Information perception sound or speech recognition\',
  121.                     manual_load_handling_transfer_carry_hold_00_to_03_kg SMALLINT DEFAULT 0 NOT NULL
  122.                         COMMENT \'Manual load handling transfer carry hold 00 to 03 kg\',
  123.                     manual_load_handling_transfer_carry_hold_03_to_10_kg SMALLINT DEFAULT 0 NOT NULL
  124.                         COMMENT \'Manual load handling transfer carry hold > 03 to 10 kg\',
  125.                     manual_load_handling_transfer_carry_hold_10_to_15_kg SMALLINT DEFAULT 0 NOT NULL
  126.                         COMMENT \'Manual load handling transfer carry hold > 10 to 15 kg\',
  127.                     manual_load_handling_transfer_carry_hold_15_to_25_kg SMALLINT DEFAULT 0 NOT NULL
  128.                         COMMENT \'Manual load handling transfer carry hold > 15 to 25 kg\',
  129.                     manual_load_handling_transfer_carry_hold_gt_25_kg SMALLINT DEFAULT 0 NOT NULL
  130.                         COMMENT \'Manual load handling transfer carry hold > 25 kg\',
  131.                     forces_motions_finger_hand_left_high_pressure_overall SMALLINT DEFAULT 0 NOT NULL
  132.                         COMMENT \'Forces motions finger hand left high pressure overall\',
  133.                     forces_motions_finger_hand_left_high_pressure_per_minute SMALLINT DEFAULT 0 NOT NULL
  134.                         COMMENT \'Forces motions finger hand left high pressure per minute\',
  135.                     forces_motions_finger_hand_left_light_pressure_overall SMALLINT DEFAULT 0 NOT NULL
  136.                         COMMENT \'Forces motions finger hand left light pressure overall\',
  137.                     forces_motions_finger_hand_left_light_pressure_per_minute SMALLINT DEFAULT 0 NOT NULL
  138.                         COMMENT \'Forces motions finger hand left light pressure per minute\',
  139.                     forces_motions_finger_hand_right_high_pressure_overall SMALLINT DEFAULT 0 NOT NULL
  140.                         COMMENT \'Forces motions finger hand right high pressure overall\',
  141.                     forces_motions_finger_hand_right_high_pressure_per_minute SMALLINT DEFAULT 0 NOT NULL
  142.                         COMMENT \'Forces motions finger hand right high pressure per minute\',
  143.                     forces_motions_finger_hand_right_light_pressure_overall SMALLINT DEFAULT 0 NOT NULL
  144.                         COMMENT \'Forces motions finger hand right light pressure overall\',
  145.                     forces_motions_finger_hand_right_light_pressure_per_minute SMALLINT DEFAULT 0 NOT NULL
  146.                         COMMENT \'Forces motions finger hand right light pressure per minute\',
  147.                     forces_motions_left_forearm_rotation_overall SMALLINT DEFAULT 0 NOT NULL
  148.                         COMMENT \'Forces motions left forearm rotation overall\',
  149.                     forces_motions_left_forearm_rotation_per_minute SMALLINT DEFAULT 0 NOT NULL
  150.                         COMMENT \'Forces motions left forearm rotation per minute\',
  151.                     forces_motions_right_forearm_rotation_overall SMALLINT DEFAULT 0 NOT NULL
  152.                         COMMENT \'Forces motions right forearm rotation overall\',
  153.                     forces_motions_right_forearm_rotation_per_minute SMALLINT DEFAULT 0 NOT NULL
  154.                         COMMENT \'Forces motions right forearm rotation per minute\',
  155.                     forces_motions_handling_of_small_tools_overall SMALLINT DEFAULT 0 NOT NULL
  156.                         COMMENT \'Forces motions handling of small tools overall\',
  157.                     forces_motions_handling_of_small_tools_per_minute SMALLINT DEFAULT 0 NOT NULL
  158.                         COMMENT \'Forces motions handling of small tools per minute\',
  159.                     forces_motions_forceful_work_with_small_tools_000_to_030_n SMALLINT DEFAULT 0 NOT NULL
  160.                         COMMENT \'Forces motions forceful work with small tools < 30 N\',
  161.                     forces_motions_forceful_work_with_small_tools_030_to_100_n SMALLINT DEFAULT 0 NOT NULL
  162.                         COMMENT \'Forces motions forceful work with small tools > 30 to 100 N\',
  163.                     forces_motions_forceful_work_with_small_tools_100_to_150_n SMALLINT DEFAULT 0 NOT NULL
  164.                         COMMENT \'Forces motions forceful work with small tools > 100 to 150 N\',
  165.                     forces_motions_forceful_work_with_small_tools_150_to_250_n SMALLINT DEFAULT 0 NOT NULL
  166.                         COMMENT \'Forces motions forceful work with small tools > 150 to 250 N\',
  167.                     forces_motions_forceful_work_with_small_tools_gt_250_n SMALLINT DEFAULT 0 NOT NULL
  168.                         COMMENT \'Forces motions forceful work with small tools > 250 N\',
  169.                     postures_climbing SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures climbing\',
  170.                     postures_kneeling SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures kneeling\',
  171.                     postures_walking SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures walking\',
  172.                     postures_seating SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures seating\',
  173.                     postures_standing SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures standing\',
  174.                     postures_bent_forward SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures bent forward\',
  175.                     postures_bent_forward_motion SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures bent forward motion\',
  176.                     postures_bent_forward_strongly SMALLINT DEFAULT 0 NOT NULL
  177.                         COMMENT \'Postures bent forward strongly\',
  178.                     postures_bent_forward_strongly_motion SMALLINT DEFAULT 0 NOT NULL
  179.                         COMMENT \'Postures bent forward strongly motion\',
  180.                     postures_torsion SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures torsion\',
  181.                     postures_torsion_motion SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures torsion motion\',
  182.                     postures_lateral_torso_inclination SMALLINT DEFAULT 0 NOT NULL
  183.                         COMMENT \'Postures lateral torso inclination\',
  184.                     postures_lateral_torso_inclination_motion SMALLINT DEFAULT 0 NOT NULL
  185.                         COMMENT \'Postures lateral torso inclination motion\',
  186.                     postures_left_arm_above_head SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures left arm above head\',
  187.                     postures_left_arm_above_head_motion SMALLINT DEFAULT 0 NOT NULL
  188.                         COMMENT \'Postures left arm above head motion\',
  189.                     postures_left_arm_above_shoulder_height SMALLINT DEFAULT 0 NOT NULL
  190.                         COMMENT \'Postures left arm above shoulder height\',
  191.                     postures_left_arm_above_shoulder_height_motion SMALLINT DEFAULT 0 NOT NULL
  192.                         COMMENT \'Postures left arm above shoulder height motion\',
  193.                     postures_right_arm_above_head SMALLINT DEFAULT 0 NOT NULL COMMENT \'Postures right arm above head\',
  194.                     postures_right_arm_above_head_motion SMALLINT DEFAULT 0 NOT NULL
  195.                         COMMENT \'Postures right arm above head motion\',
  196.                     postures_right_arm_above_shoulder_height SMALLINT DEFAULT 0 NOT NULL
  197.                         COMMENT \'Postures right arm above shoulder height\',
  198.                     postures_right_arm_above_shoulder_height_motion SMALLINT DEFAULT 0 NOT NULL
  199.                         COMMENT \'Postures right arm above shoulder height motion\',
  200.                     condition_type VARCHAR(16) NOT NULL COMMENT \'Condition type for the workplace screening\',
  201.                     critical SMALLINT DEFAULT 0 NOT NULL COMMENT \'Flag if workplace screening is critical\',
  202.                     status VARCHAR(16) NOT NULL COMMENT \'Status for the workplace screening\',
  203.                     INDEX IDX_3E1ED443DE12AB56 (created_by),
  204.                     INDEX IDX_3E1ED44316FE72E1 (updated_by),
  205.                     INDEX IDX_3E1ED443AC25FB46 (workplace_id),
  206.                     PRIMARY KEY(id)
  207.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
  208.             '
  209.         );
  210.         $this->addSql(
  211.             '
  212.                 CREATE TABLE workplace_org_unit (
  213.                     workplace_id INT NOT NULL COMMENT \'Internal ID\',
  214.                     org_unit_id INT NOT NULL COMMENT \'Internal ID\',
  215.                     INDEX IDX_8085C652AC25FB46 (workplace_id),
  216.                     INDEX IDX_8085C6528BC224C3 (org_unit_id),
  217.                     PRIMARY KEY(workplace_id, org_unit_id)
  218.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
  219.             '
  220.         );
  221.         $this->addSql(
  222.             '
  223.                 CREATE TABLE workplace_document (
  224.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  225.                     parent INT NOT NULL COMMENT \'Internal ID\',
  226.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  227.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  228.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  229.                     uuid VARCHAR(36) NOT NULL COMMENT \'UUID for file\',
  230.                     name VARCHAR(225) NOT NULL COMMENT \'Name for file\',
  231.                     mime_type VARCHAR(32) NOT NULL COMMENT \'MIME type for file\',
  232.                     hash VARCHAR(32) NOT NULL COMMENT \'Hash for file\',
  233.                     extension VARCHAR(3) NOT NULL COMMENT \'Extension for file\',
  234.                     property_name VARCHAR(32) NOT NULL COMMENT \'Property name for file\',
  235.                     UNIQUE INDEX UNIQ_1DBF54EFD17F50A6 (uuid),
  236.                     INDEX IDX_1DBF54EF3D8E604F (parent),
  237.                     PRIMARY KEY(id)
  238.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB;
  239.             '
  240.         );
  241.         $this->addSql(
  242.             '
  243.                 ALTER TABLE workplace_screening ADD CONSTRAINT FK_3E1ED443AC25FB46
  244.                     FOREIGN KEY (workplace_id) REFERENCES workplace (id) ON DELETE CASCADE;
  245.             '
  246.         );
  247.         $this->addSql(
  248.             '
  249.                 ALTER TABLE workplace_screening ADD CONSTRAINT FK_3E1ED443DE12AB56
  250.                     FOREIGN KEY (created_by) REFERENCES user (id);
  251.             '
  252.         );
  253.         $this->addSql(
  254.             '
  255.                 ALTER TABLE workplace_screening ADD CONSTRAINT FK_3E1ED44316FE72E1
  256.                     FOREIGN KEY (updated_by) REFERENCES user (id);
  257.             '
  258.         );
  259.         $this->addSql(
  260.             '
  261.                 ALTER TABLE workplace ADD CONSTRAINT FK_D0FB92EEDE12AB56
  262.                     FOREIGN KEY (created_by) REFERENCES user (id);
  263.             '
  264.         );
  265.         $this->addSql(
  266.             '
  267.                 ALTER TABLE workplace ADD CONSTRAINT FK_D0FB92EE16FE72E1
  268.                     FOREIGN KEY (updated_by) REFERENCES user (id);
  269.             '
  270.         );
  271.         $this->addSql(
  272.             '
  273.                 ALTER TABLE workplace_org_unit ADD CONSTRAINT FK_8085C652AC25FB46
  274.                     FOREIGN KEY (workplace_id) REFERENCES workplace (id) ON DELETE CASCADE;
  275.             '
  276.         );
  277.         $this->addSql(
  278.             '
  279.                 ALTER TABLE workplace_org_unit ADD CONSTRAINT FK_8085C6528BC224C3
  280.                     FOREIGN KEY (org_unit_id) REFERENCES org_unit (id) ON DELETE CASCADE;
  281.             '
  282.         );
  283.         $this->addSql(
  284.             '
  285.                 ALTER TABLE workplace_document ADD CONSTRAINT FK_1DBF54EF3D8E604F
  286.                     FOREIGN KEY (parent) REFERENCES workplace (id) ON DELETE CASCADE;
  287.             '
  288.         );
  289.     }
  290.     public function down(Schema $schema): void
  291.     {
  292.         // this down() migration is auto-generated, please modify it to your needs
  293.         $this->addSql('ALTER TABLE workplace_screening DROP FOREIGN KEY FK_3E1ED443DE12AB56');
  294.         $this->addSql('ALTER TABLE workplace_screening DROP FOREIGN KEY FK_3E1ED44316FE72E1');
  295.         $this->addSql('ALTER TABLE workplace_screening DROP FOREIGN KEY FK_3E1ED443AC25FB46');
  296.         $this->addSql('ALTER TABLE workplace DROP FOREIGN KEY FK_D0FB92EEDE12AB56');
  297.         $this->addSql('ALTER TABLE workplace DROP FOREIGN KEY FK_D0FB92EE16FE72E1');
  298.         $this->addSql('ALTER TABLE workplace_org_unit DROP FOREIGN KEY FK_8085C652AC25FB46');
  299.         $this->addSql('ALTER TABLE workplace_org_unit DROP FOREIGN KEY FK_8085C6528BC224C3');
  300.         $this->addSql('ALTER TABLE workplace_document DROP FOREIGN KEY FK_1DBF54EF3D8E604F');
  301.         $this->addSql('DROP TABLE workplace_screening');
  302.         $this->addSql('DROP TABLE workplace');
  303.         $this->addSql('DROP TABLE workplace_org_unit');
  304.         $this->addSql('DROP TABLE workplace_document');
  305.     }
  306. }