From 9b018e4a8ba74e5c95707a7febdd07356a5a90d4 Mon Sep 17 00:00:00 2001 From: Alisha Date: Thu, 6 Mar 2025 09:16:46 -0800 Subject: [PATCH 1/5] mysql complex integration test --- .../testdata/mysql/complex/create-tables.sql | 750 ++++++++++++++++++ .../testdata/mysql/complex/diagram.md | 226 ++++++ 2 files changed, 976 insertions(+) create mode 100644 internal/testutil/testdata/mysql/complex/create-tables.sql create mode 100644 internal/testutil/testdata/mysql/complex/diagram.md diff --git a/internal/testutil/testdata/mysql/complex/create-tables.sql b/internal/testutil/testdata/mysql/complex/create-tables.sql new file mode 100644 index 0000000000..04f44f037d --- /dev/null +++ b/internal/testutil/testdata/mysql/complex/create-tables.sql @@ -0,0 +1,750 @@ +-- Ensure use of InnoDB for transactional support +SET default_storage_engine=INNODB; +SET FOREIGN_KEY_CHECKS=0; -- (Disable FK checks for initial creation to handle ordering) + +-- 1. Core Tables Creation + +CREATE TABLE IF NOT EXISTS agency ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL UNIQUE, + country VARCHAR(64), + founded_year YEAR, + -- Additional fields can be added as needed + INDEX (country) +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS astronaut ( + id INT AUTO_INCREMENT PRIMARY KEY, + first_name VARCHAR(50) NOT NULL, + last_name VARCHAR(50) NOT NULL, + birth_date DATE NOT NULL, + nationality VARCHAR(50), + status ENUM('Active','Retired','Deceased') DEFAULT 'Active', + agency_id INT, + first_mission_id INT, -- FK to mission (circular dependency handled later) + CONSTRAINT uq_astronaut_name UNIQUE (first_name, last_name, birth_date), + CONSTRAINT chk_min_birth_date CHECK (birth_date >= '1900-01-01'), + FOREIGN KEY (agency_id) REFERENCES agency(id) + ON UPDATE CASCADE + ON DELETE SET NULL +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS spacecraft ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + type ENUM('Orbiter','Lander','Rover','Crewed','Probe','Station','Other') NOT NULL, + capacity INT, -- number of crew it can carry (NULL or 0 if unmanned) + status ENUM('Operational','In Mission','Retired','Lost') DEFAULT 'Operational', + agency_id INT, + last_mission_id INT, -- FK to mission (circular dependency handled later) + CONSTRAINT uq_spacecraft_name UNIQUE (name), + FOREIGN KEY (agency_id) REFERENCES agency(id) + ON UPDATE CASCADE + ON DELETE SET NULL +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS celestial_body ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + body_type ENUM('Star','Planet','Dwarf Planet','Moon','Asteroid','Comet') NOT NULL, + mass DOUBLE, -- mass could be in kg + radius DOUBLE, -- radius in km + parent_body_id INT NULL, + CONSTRAINT uq_body_name UNIQUE (name), + FOREIGN KEY (parent_body_id) REFERENCES celestial_body(id) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT chk_positive_mass CHECK (mass >= 0 OR mass IS NULL)) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS launch_site ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + location VARCHAR(255), -- e.g., "Cape Canaveral, USA" + location_coord POINT NOT NULL, -- spatial coordinate (latitude/longitude) + country VARCHAR(50), + CONSTRAINT uq_site_name UNIQUE (name), + SPATIAL INDEX (location_coord) +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS mission ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + mission_code VARCHAR(50), + mission_type ENUM('Manned','Unmanned') NOT NULL, + status ENUM('Planned','Active','Completed','Aborted','Failed') DEFAULT 'Planned', + launch_date DATE NOT NULL, + return_date DATE, + spacecraft_id INT NOT NULL, + destination_id INT NOT NULL, + launch_site_id INT NOT NULL, + primary_agency_id INT, + commander_id INT, -- FK to astronaut + CONSTRAINT uq_mission_code UNIQUE (mission_code), + CONSTRAINT chk_mission_dates CHECK (return_date IS NULL OR return_date >= launch_date), + + FOREIGN KEY (spacecraft_id) REFERENCES spacecraft(id) + ON UPDATE CASCADE + ON DELETE RESTRICT, + FOREIGN KEY (destination_id) REFERENCES celestial_body(id) + ON UPDATE CASCADE + ON DELETE RESTRICT, + FOREIGN KEY (launch_site_id) REFERENCES launch_site(id) + ON UPDATE CASCADE + ON DELETE RESTRICT, + FOREIGN KEY (primary_agency_id) REFERENCES agency(id) + ON UPDATE CASCADE + ON DELETE RESTRICT, + FOREIGN KEY (commander_id) REFERENCES astronaut(id) + ON UPDATE CASCADE + ON DELETE SET NULL +) ENGINE=InnoDB; + +-- Now, create a BEFORE INSERT trigger to enforce commander logic +DELIMITER $$ +CREATE TRIGGER trg_mission_commander_check +BEFORE INSERT ON mission +FOR EACH ROW +BEGIN + IF NEW.mission_type = 'Unmanned' AND NEW.commander_id IS NOT NULL THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Unmanned missions must not have a commander.'; + ELSEIF NEW.mission_type = 'Manned' AND NEW.commander_id IS NULL THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Manned missions must have a commander.'; + END IF; +END$$ +DELIMITER ; + + + +CREATE TABLE IF NOT EXISTS mission_crew ( + mission_id INT NOT NULL, + astronaut_id INT NOT NULL, + role ENUM('Commander','Pilot','Engineer','Scientist','Specialist') NOT NULL, + PRIMARY KEY (mission_id, astronaut_id), + FOREIGN KEY (mission_id) REFERENCES mission(id) + ON UPDATE CASCADE + ON DELETE CASCADE, + FOREIGN KEY (astronaut_id) REFERENCES astronaut(id) + ON UPDATE CASCADE + ON DELETE CASCADE, + INDEX idx_mc_astronaut (astronaut_id) -- index for queries by astronaut +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS research_project ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(200) NOT NULL, + description TEXT, + start_date DATE, + end_date DATE, + lead_astronaut_id INT, + FOREIGN KEY (lead_astronaut_id) REFERENCES astronaut(id) + ON UPDATE CASCADE + ON DELETE SET NULL, + CONSTRAINT uq_project_title UNIQUE (title), + FULLTEXT INDEX idx_project_desc (title, description) +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS project_mission ( + project_id INT NOT NULL, + mission_id INT NOT NULL, + PRIMARY KEY (project_id, mission_id), + FOREIGN KEY (project_id) REFERENCES research_project(id) + ON UPDATE CASCADE + ON DELETE CASCADE, + FOREIGN KEY (mission_id) REFERENCES mission(id) + ON UPDATE CASCADE + ON DELETE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE IF NOT EXISTS mission_log ( + log_id INT AUTO_INCREMENT PRIMARY KEY, + mission_id INT NOT NULL, + log_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + event VARCHAR(255) NOT NULL, + FOREIGN KEY (mission_id) REFERENCES mission(id) + ON UPDATE CASCADE + ON DELETE CASCADE, + INDEX idx_log_mission (mission_id) +) ENGINE=InnoDB; + + +-- 2. Add Foreign Keys for circular references (after both tables exist) + +ALTER TABLE astronaut + ADD FOREIGN KEY (first_mission_id) REFERENCES mission(id) + ON UPDATE CASCADE + ON DELETE SET NULL; + +ALTER TABLE spacecraft + ADD FOREIGN KEY (last_mission_id) REFERENCES mission(id) + ON UPDATE CASCADE + ON DELETE SET NULL; + +-- 3. Stored Procedures and Functions + +DELIMITER $$ + +-- Stored Procedure: Assign an astronaut to a mission with a given role (with transaction) +CREATE PROCEDURE assign_astronaut_to_mission( + IN p_mission_id INT, + IN p_astronaut_id INT, + IN p_role VARCHAR(20) +) +BEGIN + -- Error handler: rollback on any error + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; -- propagate error after rollback + END; + START TRANSACTION; + -- Insert crew assignment + INSERT INTO mission_crew(mission_id, astronaut_id, role) + VALUES (p_mission_id, p_astronaut_id, p_role); + -- If role is Commander, update mission's commander_id (assign this astronaut as mission commander) + IF UPPER(p_role) = 'COMMANDER' THEN + UPDATE mission + SET commander_id = p_astronaut_id + WHERE id = p_mission_id; + END IF; + -- If astronaut has no first mission recorded, set it to this mission + IF (SELECT first_mission_id FROM astronaut WHERE id = p_astronaut_id) IS NULL THEN + UPDATE astronaut + SET first_mission_id = p_mission_id + WHERE id = p_astronaut_id; + END IF; + COMMIT; +END$$ + + + +-- 4. Triggers + +-- Trigger: Before inserting a mission crew record, enforce one commander and no crew on unmanned missions +CREATE TRIGGER trg_before_mission_crew_insert +BEFORE INSERT ON mission_crew +FOR EACH ROW +BEGIN + -- Ensure no duplicate commander assignment + IF NEW.role = 'Commander' THEN + DECLARE current_commander INT; + SELECT commander_id INTO current_commander FROM mission WHERE id = NEW.mission_id; + IF current_commander IS NOT NULL AND current_commander != NEW.astronaut_id THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Cannot assign a second commander to the mission'; + END IF; + END IF; + -- Prevent crew assignment to unmanned missions + IF (SELECT mission_type FROM mission WHERE id = NEW.mission_id) = 'Unmanned' THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Cannot assign crew to an unmanned mission'; + END IF; +END$$ + +-- Trigger: After inserting a mission crew record, update mission commander and astronaut first mission if needed +CREATE TRIGGER trg_after_mission_crew_insert +AFTER INSERT ON mission_crew +FOR EACH ROW +BEGIN + -- If a commander was added to crew, ensure mission.commander_id is set to that astronaut + IF NEW.role = 'Commander' THEN + UPDATE mission + SET commander_id = NEW.astronaut_id + WHERE id = NEW.mission_id; + END IF; + -- If the astronaut has no first_mission recorded, set this mission as their first mission + IF (SELECT first_mission_id FROM astronaut WHERE id = NEW.astronaut_id) IS NULL THEN + UPDATE astronaut + SET first_mission_id = NEW.mission_id + WHERE id = NEW.astronaut_id; + END IF; +END$$ + +-- Trigger: Before inserting a mission, ensure unmanned missions have no commander (commander_id should be NULL if unmanned) +CREATE TRIGGER trg_before_mission_insert +BEFORE INSERT ON mission +FOR EACH ROW +BEGIN + IF NEW.mission_type = 'Unmanned' AND NEW.commander_id IS NOT NULL THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Unmanned missions cannot have a commander'; + END IF; +END$$ + +-- Trigger: After inserting a mission, log creation and auto-add commander to crew if provided +CREATE TRIGGER trg_after_mission_insert +AFTER INSERT ON mission +FOR EACH ROW +BEGIN + -- Log mission creation + INSERT INTO mission_log(mission_id, event) + VALUES (NEW.id, CONCAT('Mission "', NEW.name, '" created')); + -- If a commander was specified, automatically add them to mission_crew + IF NEW.commander_id IS NOT NULL THEN + INSERT IGNORE INTO mission_crew(mission_id, astronaut_id, role) + VALUES (NEW.id, NEW.commander_id, 'Commander'); + -- (INSERT IGNORE is used to avoid error if a record somehow already exists) + END IF; +END$$ + +-- Trigger: After updating a mission, log status/commander changes and update spacecraft status +CREATE TRIGGER trg_after_mission_update +AFTER UPDATE ON mission +FOR EACH ROW +BEGIN + -- Log status change + IF NEW.status <> OLD.status THEN + INSERT INTO mission_log(mission_id, event) + VALUES (NEW.id, CONCAT('Mission status changed from ', OLD.status, ' to ', NEW.status)); + -- Update spacecraft status based on mission status changes + IF NEW.status = 'Active' THEN + UPDATE spacecraft + SET status = 'In Mission' + WHERE id = NEW.spacecraft_id; + ELSEIF NEW.status = 'Completed' THEN + UPDATE spacecraft + SET status = 'Operational', + last_mission_id = NEW.id + WHERE id = NEW.spacecraft_id; + ELSEIF NEW.status IN ('Failed','Aborted') THEN + UPDATE spacecraft + SET status = 'Lost', + last_mission_id = NEW.id + WHERE id = NEW.spacecraft_id; + END IF; + END IF; + -- Log commander change + IF NEW.commander_id <> OLD.commander_id THEN + IF NEW.commander_id IS NULL THEN + INSERT INTO mission_log(mission_id, event) + VALUES (NEW.id, 'Mission commander unassigned'); + ELSE + -- Fetch new commander's name for the log + INSERT INTO mission_log(mission_id, event) + VALUES (NEW.id, CONCAT('Commander changed to astronaut ID ', NEW.commander_id)); + -- (In practice, we might join astronaut for name, but for simplicity using ID) + END IF; + END IF; +END$$ + +DELIMITER ; + +-- 5. Views + +-- View: Mission Summary (combining details from multiple tables) +CREATE OR REPLACE VIEW v_mission_summary AS +SELECT + m.id AS mission_id, + m.name AS mission_name, + m.mission_type, + m.status, + m.launch_date, + m.return_date, + DATEDIFF(m.return_date, m.launch_date) AS duration_days, + cb.name AS destination_name, + ls.name AS launch_site_name, + sc.name AS spacecraft_name, + CONCAT(ascomm.first_name, ' ', ascomm.last_name) AS commander_name, + ag.name AS primary_agency, + -- subquery to count crew members on this mission + (SELECT COUNT(*) FROM mission_crew mc WHERE mc.mission_id = m.id) AS crew_count +FROM mission m +LEFT JOIN astronaut ascomm ON m.commander_id = ascomm.id +LEFT JOIN spacecraft sc ON m.spacecraft_id = sc.id +LEFT JOIN celestial_body cb ON m.destination_id = cb.id +LEFT JOIN launch_site ls ON m.launch_site_id = ls.id +LEFT JOIN agency ag ON m.primary_agency_id = ag.id; + +-- View: Astronaut Stats (missions count and total days in space per astronaut) +CREATE OR REPLACE VIEW v_astronaut_stats AS +SELECT + a.id AS astronaut_id, + CONCAT(a.first_name, ' ', a.last_name) AS astronaut_name, + a.nationality, + a.status, + ag.name AS agency_name, + -- Count distinct missions (in case an astronaut had multiple roles in same mission, though our model prevents duplicates) + IFNULL(COUNT(DISTINCT mc.mission_id), 0) AS mission_count, + IFNULL(SUM(DATEDIFF(m.return_date, m.launch_date)), 0) AS total_days_in_space, + fm.name AS first_mission_name +FROM astronaut a +LEFT JOIN agency ag ON a.agency_id = ag.id +LEFT JOIN mission fm ON a.first_mission_id = fm.id +LEFT JOIN mission_crew mc ON a.id = mc.astronaut_id +LEFT JOIN mission m ON mc.mission_id = m.id AND m.return_date IS NOT NULL -- only count completed missions for days +GROUP BY a.id, a.first_name, a.last_name, a.nationality, a.status, ag.name, fm.name; + + + +-- 1) OBSERVATORY +CREATE TABLE IF NOT EXISTS observatory ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + agency_id INT NOT NULL, -- cross-schema reference to agency + launch_site_id INT NULL, -- optional link to launch_site if co-located + location_coord POINT NULL, -- optional spatial coordinate for ground location + status ENUM('Active','Under Maintenance','Retired') NOT NULL DEFAULT 'Active', + CONSTRAINT uq_observatory_name UNIQUE (name) +) ENGINE=InnoDB; + +-- 2) TELESCOPE +CREATE TABLE IF NOT EXISTS telescope ( + id INT AUTO_INCREMENT PRIMARY KEY, + observatory_id INT NOT NULL, + name VARCHAR(100) NOT NULL, + telescope_type ENUM('Optical','Radio','Infrared','UV','X-Ray','Other') NOT NULL DEFAULT 'Optical', + mirror_diameter_m DOUBLE, -- diameter in meters + status ENUM('Operational','Damaged','Retired') DEFAULT 'Operational', + CONSTRAINT uq_telescope_name UNIQUE (name) +) ENGINE=InnoDB; + +-- 3) INSTRUMENT +CREATE TABLE IF NOT EXISTS instrument ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + instrument_type ENUM('Camera','Spectrometer','Sensor','Module','Other') NOT NULL, + telescope_id INT NULL, -- if installed on a telescope + spacecraft_id INT NULL, -- cross-schema reference to spacecraft + status ENUM('Available','In Use','Damaged','Retired') DEFAULT 'Available', + CONSTRAINT uq_instrument_name UNIQUE (name) +) ENGINE=InnoDB; + +-- 4) OBSERVATION_SESSION +CREATE TABLE IF NOT EXISTS observation_session ( + id INT AUTO_INCREMENT PRIMARY KEY, + telescope_id INT NULL, -- which telescope used + instrument_id INT NULL, -- which instrument used, if not the telescope alone + target_body_id INT NULL, -- cross-schema reference: celestial_body + mission_id INT NULL, -- cross-schema reference: mission (if part of a mission) + start_time DATETIME NOT NULL, + end_time DATETIME NULL, + seeing_conditions ENUM('Excellent','Good','Fair','Poor') DEFAULT 'Good', + notes TEXT +) ENGINE=InnoDB; + +-- 5) DATA_SET +CREATE TABLE IF NOT EXISTS data_set ( + id INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(100) NOT NULL, + mission_id INT NULL, -- cross-schema reference: mission + observation_id INT NULL, -- reference cosmic_research.observation_session + data_description TEXT, + data_blob LONGBLOB NULL, -- optional raw data + collected_on DATE NOT NULL, + CONSTRAINT uq_data_set_name UNIQUE (name) +) ENGINE=InnoDB; + +-- 6) RESEARCH_PAPER +CREATE TABLE IF NOT EXISTS research_paper ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(200) NOT NULL, + abstract TEXT, + published_date DATE, + doi VARCHAR(100), -- unique ID for academic papers + project_id INT NULL, -- cross-schema reference: research_project + observatory_id INT NULL, -- if the paper is from ground-based research + CONSTRAINT uq_paper_doi UNIQUE (doi), + FULLTEXT INDEX idx_paper_ft (title, abstract) +) ENGINE=InnoDB; + +-- 7) PAPER_CITATION +CREATE TABLE IF NOT EXISTS paper_citation ( + citing_paper_id INT NOT NULL, -- referencing cosmic_research.research_paper + cited_paper_id INT NOT NULL, -- referencing cosmic_research.research_paper + citation_date DATE NOT NULL, + PRIMARY KEY (citing_paper_id, cited_paper_id) +) ENGINE=InnoDB; + +-- 8) GRANT +CREATE TABLE IF NOT EXISTS `grant` ( + id INT AUTO_INCREMENT PRIMARY KEY, + grant_number VARCHAR(50) NOT NULL, + agency_id INT NOT NULL, -- cross-schema reference: agency + funding_amount DECIMAL(15,2) NOT NULL DEFAULT 0, + start_date DATE NOT NULL, + end_date DATE NULL, + status ENUM('Proposed','Awarded','Active','Closed','Canceled') NOT NULL DEFAULT 'Proposed', + CONSTRAINT uq_grant_number UNIQUE (grant_number) +) ENGINE=InnoDB; + +-- 9) GRANT_RESEARCH_PROJECT +CREATE TABLE IF NOT EXISTS grant_research_project ( + grant_id INT NOT NULL, + research_project_id INT NOT NULL, -- cross-schema reference: research_project + allocated_amount DECIMAL(15,2), + PRIMARY KEY (grant_id, research_project_id) +) ENGINE=InnoDB; + +-- 10) INSTRUMENT_USAGE +CREATE TABLE IF NOT EXISTS instrument_usage ( + id INT AUTO_INCREMENT PRIMARY KEY, + instrument_id INT NOT NULL, + telescope_id INT NULL, -- if used on a telescope + spacecraft_id INT NULL, -- cross-schema reference: spacecraft + start_date DATE NOT NULL, + end_date DATE NULL, + usage_notes TEXT +) ENGINE=InnoDB; + +SET FOREIGN_KEY_CHECKS=1; + +-- Now add the foreign keys referencing the original space schema and local references. +-- NOTE: The exact schema name of the original DB is assumed to be `space`. +-- Adjust if your actual schema name is different. + +ALTER TABLE observatory + ADD CONSTRAINT fk_obs_agency + FOREIGN KEY (agency_id) + REFERENCES agency(id) + ON UPDATE CASCADE + ON DELETE RESTRICT, + ADD CONSTRAINT fk_obs_launch_site + FOREIGN KEY (launch_site_id) + REFERENCES launch_site(id) + ON UPDATE CASCADE + ON DELETE SET NULL; + +ALTER TABLE telescope + ADD CONSTRAINT fk_telescope_obs + FOREIGN KEY (observatory_id) + REFERENCES observatory(id) + ON UPDATE CASCADE + ON DELETE CASCADE; + +ALTER TABLE instrument + ADD CONSTRAINT fk_instrument_telescope + FOREIGN KEY (telescope_id) + REFERENCES telescope(id) + ON UPDATE CASCADE + ON DELETE SET NULL, + ADD CONSTRAINT fk_instrument_spacecraft + FOREIGN KEY (spacecraft_id) + REFERENCES spacecraft(id) + ON UPDATE CASCADE + ON DELETE SET NULL; + +ALTER TABLE observation_session + ADD CONSTRAINT fk_obs_sess_telescope + FOREIGN KEY (telescope_id) + REFERENCES telescope(id) + ON UPDATE CASCADE + ON DELETE SET NULL, + ADD CONSTRAINT fk_obs_sess_instrument + FOREIGN KEY (instrument_id) + REFERENCES instrument(id) + ON UPDATE CASCADE + ON DELETE SET NULL, + ADD CONSTRAINT fk_obs_sess_body + FOREIGN KEY (target_body_id) + REFERENCES celestial_body(id) + ON UPDATE CASCADE + ON DELETE SET NULL, + ADD CONSTRAINT fk_obs_sess_mission + FOREIGN KEY (mission_id) + REFERENCES mission(id) + ON UPDATE CASCADE + ON DELETE SET NULL; + +ALTER TABLE data_set + ADD CONSTRAINT fk_dataset_mission + FOREIGN KEY (mission_id) + REFERENCES mission(id) + ON UPDATE CASCADE + ON DELETE SET NULL, + ADD CONSTRAINT fk_dataset_obs + FOREIGN KEY (observation_id) + REFERENCES observation_session(id) + ON UPDATE CASCADE + ON DELETE SET NULL; + +ALTER TABLE research_paper + ADD CONSTRAINT fk_paper_proj + FOREIGN KEY (project_id) + REFERENCES research_project(id) + ON UPDATE CASCADE + ON DELETE SET NULL, + ADD CONSTRAINT fk_paper_obs + FOREIGN KEY (observatory_id) + REFERENCES observatory(id) + ON UPDATE CASCADE + ON DELETE SET NULL; + +ALTER TABLE paper_citation + ADD CONSTRAINT fk_citation_citing + FOREIGN KEY (citing_paper_id) + REFERENCES research_paper(id) + ON DELETE CASCADE + ON UPDATE CASCADE, + ADD CONSTRAINT fk_citation_cited + FOREIGN KEY (cited_paper_id) + REFERENCES research_paper(id) + ON DELETE CASCADE + ON UPDATE CASCADE; + +ALTER TABLE `grant` + ADD CONSTRAINT fk_grant_agency + FOREIGN KEY (agency_id) + REFERENCES agency(id) + ON UPDATE CASCADE + ON DELETE RESTRICT; + +ALTER TABLE grant_research_project + ADD CONSTRAINT fk_grp_grant + FOREIGN KEY (grant_id) + REFERENCES `grant`(id) + ON UPDATE CASCADE + ON DELETE CASCADE, + ADD CONSTRAINT fk_grp_project + FOREIGN KEY (research_project_id) + REFERENCES research_project(id) + ON UPDATE CASCADE + ON DELETE CASCADE; + +ALTER TABLE instrument_usage + ADD CONSTRAINT fk_instrument_usage_instr + FOREIGN KEY (instrument_id) + REFERENCES instrument(id) + ON UPDATE CASCADE + ON DELETE CASCADE, + ADD CONSTRAINT fk_instrument_usage_telescope + FOREIGN KEY (telescope_id) + REFERENCES telescope(id) + ON UPDATE CASCADE + ON DELETE SET NULL, + ADD CONSTRAINT fk_instrument_usage_spacecraft + FOREIGN KEY (spacecraft_id) + REFERENCES spacecraft(id) + ON UPDATE CASCADE + ON DELETE SET NULL; + +-- +-- Sample Constraints & Triggers for Additional Complexity +-- + +-- Example CHECK constraints (MySQL 8+) +ALTER TABLE telescope + ADD CONSTRAINT chk_telescope_mirror CHECK ( + (telescope_type IN ('Optical','Infrared','UV','X-Ray') AND mirror_diameter_m > 0) + OR (telescope_type = 'Radio') + OR (telescope_type = 'Other') + ); + +-- Example trigger: Prevent new observation sessions on a retired telescope +DELIMITER $$ +CREATE TRIGGER trg_before_observation_session_insert +BEFORE INSERT ON observation_session +FOR EACH ROW +BEGIN + IF NEW.telescope_id IS NOT NULL THEN + IF (SELECT status FROM telescope WHERE id = NEW.telescope_id) = 'Retired' THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Cannot create observation session on a retired telescope.'; + END IF; + END IF; +END$$ +DELIMITER ; + +-- Example stored procedure: awarding a grant +DELIMITER $$ +CREATE PROCEDURE sp_award_grant( + IN p_grant_id INT, + IN p_start_date DATE, + IN p_end_date DATE, + IN p_amount DECIMAL(15,2) +) +BEGIN + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + UPDATE `grant` + SET status = 'Awarded', + start_date = p_start_date, + end_date = p_end_date, + funding_amount = p_amount + WHERE id = p_grant_id; + + -- We could insert a log or do additional checks here... + COMMIT; +END$$ +DELIMITER ; + +-- Example function: count citations of a research paper +DELIMITER $$ +CREATE FUNCTION fn_paper_citation_count(p_paper_id INT) +RETURNS INT +DETERMINISTIC +READS SQL DATA +BEGIN + DECLARE ccount INT; + SELECT COUNT(*) + INTO ccount + FROM paper_citation + WHERE cited_paper_id = p_paper_id; + RETURN ccount; +END$$ +DELIMITER ; + +-- +-- Example View: v_cross_schema_projects +-- Joins a cosmic_research.grant with research_project +-- to show cross-schema data +-- +CREATE OR REPLACE VIEW v_cross_schema_projects AS +SELECT + g.id AS grant_id, + g.grant_number, + g.funding_amount, + rp.id AS project_id, + rp.title AS project_title, + rp.description AS project_description, + rp.start_date, + rp.end_date, + s_ag.name AS sponsoring_agency +FROM `grant` g +JOIN grant_research_project grp ON g.id = grp.grant_id +JOIN research_project rp ON grp.research_project_id = rp.id +LEFT JOIN agency s_ag ON g.agency_id = s_ag.id; + + +DELIMITER $$ +-- Stored Function: Mission duration in days +CREATE FUNCTION mission_duration_days(p_mission_id INT) +RETURNS INT +DETERMINISTIC +READS SQL DATA +BEGIN + DECLARE days INT; + SELECT + CASE + WHEN return_date IS NOT NULL + THEN DATEDIFF(return_date, launch_date) + ELSE NULL + END + INTO days + FROM mission + WHERE id = p_mission_id; + RETURN days; +END$$ + +DELIMITER ; + +DELIMITER $$ + +CREATE FUNCTION astronaut_mission_count(p_astro_id INT) +RETURNS INT +DETERMINISTIC +READS SQL DATA +BEGIN + DECLARE m_count INT; + SELECT COUNT(*) INTO m_count + FROM mission_crew + WHERE astronaut_id = p_astro_id; + RETURN IFNULL(m_count, 0); +END$$ + +DELIMITER ; diff --git a/internal/testutil/testdata/mysql/complex/diagram.md b/internal/testutil/testdata/mysql/complex/diagram.md new file mode 100644 index 0000000000..c88077bbdb --- /dev/null +++ b/internal/testutil/testdata/mysql/complex/diagram.md @@ -0,0 +1,226 @@ +erDiagram + + AGENCY ||--|{ ASTRONAUT : "employs" + AGENCY ||--|{ SPACECRAFT : "owns" + AGENCY ||--|{ MISSION : "primary agency" + + ASTRONAUT ||--|{ MISSION_CREW : "many-to-many link" + + SPACECRAFT }|--|| MISSION : "used by (spacecraft_id)" + + CELESTIAL_BODY ||--|{ CELESTIAL_BODY : "self reference (parent_body_id)" + + MISSION ||--|{ MISSION_CREW : "crew assignments" + MISSION ||--|{ MISSION_LOG : "has logs" + MISSION }|--|| SPACECRAFT : "FK: spacecraft_id" + MISSION }|--|| CELESTIAL_BODY : "FK: destination_id" + MISSION }|--|| LAUNCH_SITE : "FK: launch_site_id" + MISSION }|--|| AGENCY : "FK: primary_agency_id" + MISSION }|--|| ASTRONAUT : "commander" + + MISSION_CREW }|--|| MISSION : "FK: mission_id" + MISSION_CREW }|--|| ASTRONAUT : "FK: astronaut_id" + + PROJECT_MISSION }|--|| RESEARCH_PROJECT : "FK: project_id" + PROJECT_MISSION }|--|| MISSION : "FK: mission_id" + + MISSION_LOG }|--|| MISSION : "FK: mission_id" + + + + %% Table Definitions + AGENCY { + int id PK + varchar name + varchar country + year founded_year + } + + ASTRONAUT { + int id PK + varchar first_name + varchar last_name + date birth_date + varchar nationality + enum status + int agency_id FK + int first_mission_id FK + } + + SPACECRAFT { + int id PK + varchar name + enum type + int capacity + enum status + int agency_id FK + int last_mission_id FK + } + + CELESTIAL_BODY { + int id PK + varchar name + enum body_type + double mass + double radius + int parent_body_id FK + } + + LAUNCH_SITE { + int id PK + varchar name + varchar location + point location_coord + varchar country + } + + MISSION { + int id PK + varchar name + varchar mission_code + enum mission_type + enum status + date launch_date + date return_date + int spacecraft_id FK + int destination_id FK + int launch_site_id FK + int primary_agency_id FK + int commander_id FK + } + + MISSION_CREW { + int mission_id PK + int astronaut_id PK + enum role + } + + RESEARCH_PROJECT { + int id PK + varchar title + text description + date start_date + date end_date + int lead_astronaut_id FK + } + + PROJECT_MISSION { + int project_id PK + int mission_id PK + } + + MISSION_LOG { + int log_id PK + int mission_id FK + timestamp log_time + varchar event + } + +%% ========== COSMIC_RESEARCH SCHEMA (new) ========== +OBSERVATORY { + int id PK + varchar name + int agency_id FK + int launch_site_id FK + enum status + point location_coord + } + + TELESCOPE { + int id PK + int observatory_id FK + varchar name + enum telescope_type + double mirror_diameter_m + enum status + } + + INSTRUMENT { + int id PK + varchar name + enum instrument_type + int telescope_id FK + int spacecraft_id FK + enum status + } + + OBSERVATION_SESSION { + int id PK + int telescope_id FK + int instrument_id FK + int target_body_id FK + int mission_id FK + datetime start_time + datetime end_time + enum seeing_conditions + text notes + } + + DATA_SET { + int id PK + varchar name + int mission_id FK + int observation_id FK + text data_description + longblob data_blob + date collected_on + } + + RESEARCH_PAPER { + int id PK + varchar title + text abstract + date published_date + varchar doi + int project_id FK + int observatory_id FK + } + + PAPER_CITATION { + int citing_paper_id PK, FK + int cited_paper_id PK, FK + date citation_date + } + + GRANT { + int id PK + varchar grant_number + int agency_id FK + decimal funding_amount + date start_date + date end_date + enum status + } + + GRANT_RESEARCH_PROJECT { + int grant_id PK, FK + int research_project_id PK, FK + decimal allocated_amount + } + + INSTRUMENT_USAGE { + int id PK + int instrument_id FK + int telescope_id FK + int spacecraft_id FK + date start_date + date end_date + text usage_notes + } + + %% Relationships among cosmic_research tables + OBSERVATORY ||--|{ TELESCOPE : has + TELESCOPE ||--|{ INSTRUMENT : can_host_instrument + TELESCOPE ||--|{ OBSERVATION_SESSION : used_in + INSTRUMENT ||--|{ OBSERVATION_SESSION : used_in + OBSERVATION_SESSION ||--|{ DATA_SET : produces + RESEARCH_PAPER }|..|| OBSERVATORY : from + RESEARCH_PAPER }|..|| RESEARCH_PROJECT : pertains_to + RESEARCH_PAPER ||--|{ PAPER_CITATION : citing + RESEARCH_PAPER ||--|{ PAPER_CITATION : cited + GRANT ||--|{ GRANT_RESEARCH_PROJECT : funds + RESEARCH_PROJECT ||--|{ GRANT_RESEARCH_PROJECT : funded + + INSTRUMENT_USAGE ||--|| INSTRUMENT : usage_of + INSTRUMENT_USAGE }|--|| TELESCOPE : usage_on_telescope + INSTRUMENT_USAGE }|--|| SPACECRAFT : usage_on_spacecraft From 9f73dff5b035bfa236c2033c0ee3497514a7df54 Mon Sep 17 00:00:00 2001 From: Alisha Date: Mon, 10 Mar 2025 15:05:41 -0700 Subject: [PATCH 2/5] mysql complex integration test --- .../worker/workflow/mysql_test.go | 78 + .../workflow/workflow-integration_test.go | 5 + .../testdata/gen_jobmappings_config.json | 125 +- .../testdata/mysql/complex/create-tables.sql | 537 +++-- .../testdata/mysql/complex/inserts.sql | 0 .../testdata/mysql/complex/job-mappings.go | 2082 +++++++++++++++++ 6 files changed, 2492 insertions(+), 335 deletions(-) create mode 100644 internal/testutil/testdata/mysql/complex/inserts.sql create mode 100644 internal/testutil/testdata/mysql/complex/job-mappings.go diff --git a/internal/integration-tests/worker/workflow/mysql_test.go b/internal/integration-tests/worker/workflow/mysql_test.go index d4ebd7551d..98dcb31828 100644 --- a/internal/integration-tests/worker/workflow/mysql_test.go +++ b/internal/integration-tests/worker/workflow/mysql_test.go @@ -14,6 +14,7 @@ import ( tcmysql "github.com/nucleuscloud/neosync/internal/testutil/testcontainers/mysql" testutil_testdata "github.com/nucleuscloud/neosync/internal/testutil/testdata" mysql_alltypes "github.com/nucleuscloud/neosync/internal/testutil/testdata/mysql/alltypes" + mysql_complex "github.com/nucleuscloud/neosync/internal/testutil/testdata/mysql/complex" mysql_composite_keys "github.com/nucleuscloud/neosync/internal/testutil/testdata/mysql/composite-keys" mysql_edgecases "github.com/nucleuscloud/neosync/internal/testutil/testdata/mysql/edgecases" mysql_human_resources "github.com/nucleuscloud/neosync/internal/testutil/testdata/mysql/humanresources" @@ -413,6 +414,83 @@ func test_mysql_on_conflict_do_update( require.NoError(t, err) } +func test_mysql_complex( + t *testing.T, + ctx context.Context, + mysql *tcmysql.MysqlTestSyncContainer, + neosyncApi *tcneosyncapi.NeosyncApiTestClient, + dbManagers *TestDatabaseManagers, + accountId string, + sourceConn, destConn *mgmtv1alpha1.Connection, +) { + jobclient := neosyncApi.OSSUnauthenticatedLicensedClients.Jobs() + schema := "complex" + + err := mysql.Source.RunCreateStmtsInDatabase(ctx, mysqlTestdataFolder, []string{"complex/create-tables.sql"}, schema) + require.NoError(t, err) + + neosyncApi.MockTemporalForCreateJob("test-mysql-sync") + + mappings := mysql_complex.GetDefaultSyncJobMappings(schema) + + job := createMysqlSyncJob(t, ctx, jobclient, &createJobConfig{ + AccountId: accountId, + SourceConn: sourceConn, + DestConn: destConn, + JobName: "mysql_complex", + JobMappings: mappings, + JobOptions: &TestJobOptions{ + Truncate: false, + InitSchema: true, + OnConflictDoUpdate: false, + }, + }) + + testworkflow := NewTestDataSyncWorkflowEnv(t, neosyncApi, dbManagers) + testworkflow.RequireActivitiesCompletedSuccessfully(t) + testworkflow.ExecuteTestDataSyncWorkflow(job.GetId()) + require.Truef(t, testworkflow.TestEnv.IsWorkflowCompleted(), "Workflow did not complete. Test: mysql_complex") + err = testworkflow.TestEnv.GetWorkflowError() + require.NoError(t, err, "Received Temporal Workflow Error: mysql_complex") + + expectedResults := []struct { + schema string + table string + rowCount int + }{ + {schema, "agency", 0}, + {schema, "astronaut", 0}, + {schema, "spacecraft", 0}, + {schema, "celestial_body", 0}, + {schema, "launch_site", 0}, + {schema, "mission", 0}, + {schema, "mission_crew", 0}, + {schema, "research_project", 0}, + {schema, "project_mission", 0}, + {schema, "mission_log", 0}, + {schema, "observatory", 0}, + {schema, "telescope", 0}, + {schema, "instrument", 0}, + {schema, "observation_session", 0}, + {schema, "data_set", 0}, + {schema, "research_paper", 0}, + {schema, "paper_citation", 0}, + {schema, "grant", 0}, + {schema, "grant_research_project", 0}, + {schema, "instrument_usage", 0}, + } + + for _, expected := range expectedResults { + rowCount, err := mysql.Target.GetTableRowCount(ctx, expected.schema, expected.table) + require.NoError(t, err) + require.Equalf(t, expected.rowCount, rowCount, fmt.Sprintf("Test: mysql_complex Table: %s", expected.table)) + } + + // tear down + err = cleanupMysqlDatabases(ctx, mysql, []string{schema}) + require.NoError(t, err) +} + func cleanupMysqlDatabases(ctx context.Context, mysql *tcmysql.MysqlTestSyncContainer, databases []string) error { errgrp, errctx := errgroup.WithContext(ctx) errgrp.Go(func() error { return mysql.Source.DropDatabases(errctx, databases) }) diff --git a/internal/integration-tests/worker/workflow/workflow-integration_test.go b/internal/integration-tests/worker/workflow/workflow-integration_test.go index fea3f191ed..118d4c5024 100644 --- a/internal/integration-tests/worker/workflow/workflow-integration_test.go +++ b/internal/integration-tests/worker/workflow/workflow-integration_test.go @@ -149,6 +149,11 @@ func Test_Workflow(t *testing.T) { test_mysql_on_conflict_do_update(t, ctx, mysql, neosyncApi, dbManagers, accountId, sourceConn, destConn) }) + t.Run("complex", func(t *testing.T) { + t.Parallel() + test_mysql_complex(t, ctx, mysql, neosyncApi, dbManagers, accountId, sourceConn, destConn) + }) + t.Cleanup(func() { err := mysql.TearDown(ctx) if err != nil { diff --git a/internal/testutil/testdata/gen_jobmappings_config.json b/internal/testutil/testdata/gen_jobmappings_config.json index cf29d83b32..26b11c3a78 100644 --- a/internal/testutil/testdata/gen_jobmappings_config.json +++ b/internal/testutil/testdata/gen_jobmappings_config.json @@ -1,62 +1,67 @@ [ - { - "folder":"postgres/alltypes", - "sql_file": "create-tables.sql", - "driver": "postgres" - }, - { - "folder":"postgres/humanresources", - "sql_file": "create-tables.sql", - "driver": "postgres" - }, - { - "folder": "postgres/edgecases", - "sql_file": "create-tables.sql", - "driver": "postgres" - }, - { - "folder": "postgres/uuids", - "sql_file": "create-tables.sql", - "driver": "postgres" - }, - { - "folder": "postgres/transformers", - "sql_file": "create-tables.sql", - "driver": "postgres" - }, - { - "folder": "postgres/foreignkey-violations", - "sql_file": "create-tables.sql", - "driver": "postgres" - }, - { - "folder": "postgres/subsetting", - "sql_file": "create-tables.sql", - "driver": "postgres" - }, - { - "folder": "mysql/alltypes", - "sql_file": "create-tables.sql", - "driver": "mysql" - }, - { - "folder": "mysql/humanresources", - "sql_file": "create-tables.sql", - "driver": "mysql" - }, - { - "folder": "mysql/composite-keys", - "sql_file": "create-tables.sql", - "driver": "mysql" - }, - { - "folder": "mysql/edgecases", - "sql_file": "create-tables.sql", - "driver": "mysql" - }, - { - "folder": "mssql/alltypes", - "sql_file": "create-tables.sql", - "driver": "mssql" - } + { + "folder": "postgres/alltypes", + "sql_file": "create-tables.sql", + "driver": "postgres" + }, + { + "folder": "postgres/humanresources", + "sql_file": "create-tables.sql", + "driver": "postgres" + }, + { + "folder": "postgres/edgecases", + "sql_file": "create-tables.sql", + "driver": "postgres" + }, + { + "folder": "postgres/uuids", + "sql_file": "create-tables.sql", + "driver": "postgres" + }, + { + "folder": "postgres/transformers", + "sql_file": "create-tables.sql", + "driver": "postgres" + }, + { + "folder": "postgres/foreignkey-violations", + "sql_file": "create-tables.sql", + "driver": "postgres" + }, + { + "folder": "postgres/subsetting", + "sql_file": "create-tables.sql", + "driver": "postgres" + }, + { + "folder": "mysql/alltypes", + "sql_file": "create-tables.sql", + "driver": "mysql" + }, + { + "folder": "mysql/humanresources", + "sql_file": "create-tables.sql", + "driver": "mysql" + }, + { + "folder": "mysql/composite-keys", + "sql_file": "create-tables.sql", + "driver": "mysql" + }, + { + "folder": "mysql/edgecases", + "sql_file": "create-tables.sql", + "driver": "mysql" + }, + { + "folder": "mysql/complex", + "sql_file": "create-tables.sql", + "driver": "mysql" + }, + { + "folder": "mssql/alltypes", + "sql_file": "create-tables.sql", + "driver": "mssql" + } ] diff --git a/internal/testutil/testdata/mysql/complex/create-tables.sql b/internal/testutil/testdata/mysql/complex/create-tables.sql index 04f44f037d..bbd10e4373 100644 --- a/internal/testutil/testdata/mysql/complex/create-tables.sql +++ b/internal/testutil/testdata/mysql/complex/create-tables.sql @@ -1,17 +1,13 @@ --- Ensure use of InnoDB for transactional support -SET default_storage_engine=INNODB; SET FOREIGN_KEY_CHECKS=0; -- (Disable FK checks for initial creation to handle ordering) --- 1. Core Tables Creation CREATE TABLE IF NOT EXISTS agency ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL UNIQUE, country VARCHAR(64), founded_year YEAR, - -- Additional fields can be added as needed INDEX (country) -) ENGINE=InnoDB; +); CREATE TABLE IF NOT EXISTS astronaut ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -27,7 +23,7 @@ CREATE TABLE IF NOT EXISTS astronaut ( FOREIGN KEY (agency_id) REFERENCES agency(id) ON UPDATE CASCADE ON DELETE SET NULL -) ENGINE=InnoDB; +); CREATE TABLE IF NOT EXISTS spacecraft ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -41,7 +37,7 @@ CREATE TABLE IF NOT EXISTS spacecraft ( FOREIGN KEY (agency_id) REFERENCES agency(id) ON UPDATE CASCADE ON DELETE SET NULL -) ENGINE=InnoDB; +); CREATE TABLE IF NOT EXISTS celestial_body ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -54,7 +50,7 @@ CREATE TABLE IF NOT EXISTS celestial_body ( FOREIGN KEY (parent_body_id) REFERENCES celestial_body(id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT chk_positive_mass CHECK (mass >= 0 OR mass IS NULL)) ENGINE=InnoDB; + CONSTRAINT chk_positive_mass CHECK (mass >= 0 OR mass IS NULL)); CREATE TABLE IF NOT EXISTS launch_site ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -64,7 +60,7 @@ CREATE TABLE IF NOT EXISTS launch_site ( country VARCHAR(50), CONSTRAINT uq_site_name UNIQUE (name), SPATIAL INDEX (location_coord) -) ENGINE=InnoDB; +); CREATE TABLE IF NOT EXISTS mission ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -97,23 +93,8 @@ CREATE TABLE IF NOT EXISTS mission ( FOREIGN KEY (commander_id) REFERENCES astronaut(id) ON UPDATE CASCADE ON DELETE SET NULL -) ENGINE=InnoDB; +); --- Now, create a BEFORE INSERT trigger to enforce commander logic -DELIMITER $$ -CREATE TRIGGER trg_mission_commander_check -BEFORE INSERT ON mission -FOR EACH ROW -BEGIN - IF NEW.mission_type = 'Unmanned' AND NEW.commander_id IS NOT NULL THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Unmanned missions must not have a commander.'; - ELSEIF NEW.mission_type = 'Manned' AND NEW.commander_id IS NULL THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Manned missions must have a commander.'; - END IF; -END$$ -DELIMITER ; @@ -129,7 +110,7 @@ CREATE TABLE IF NOT EXISTS mission_crew ( ON UPDATE CASCADE ON DELETE CASCADE, INDEX idx_mc_astronaut (astronaut_id) -- index for queries by astronaut -) ENGINE=InnoDB; +); CREATE TABLE IF NOT EXISTS research_project ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -143,7 +124,7 @@ CREATE TABLE IF NOT EXISTS research_project ( ON DELETE SET NULL, CONSTRAINT uq_project_title UNIQUE (title), FULLTEXT INDEX idx_project_desc (title, description) -) ENGINE=InnoDB; +); CREATE TABLE IF NOT EXISTS project_mission ( project_id INT NOT NULL, @@ -155,7 +136,7 @@ CREATE TABLE IF NOT EXISTS project_mission ( FOREIGN KEY (mission_id) REFERENCES mission(id) ON UPDATE CASCADE ON DELETE CASCADE -) ENGINE=InnoDB; +); CREATE TABLE IF NOT EXISTS mission_log ( log_id INT AUTO_INCREMENT PRIMARY KEY, @@ -166,7 +147,7 @@ CREATE TABLE IF NOT EXISTS mission_log ( ON UPDATE CASCADE ON DELETE CASCADE, INDEX idx_log_mission (mission_id) -) ENGINE=InnoDB; +); -- 2. Add Foreign Keys for circular references (after both tables exist) @@ -181,199 +162,6 @@ ALTER TABLE spacecraft ON UPDATE CASCADE ON DELETE SET NULL; --- 3. Stored Procedures and Functions - -DELIMITER $$ - --- Stored Procedure: Assign an astronaut to a mission with a given role (with transaction) -CREATE PROCEDURE assign_astronaut_to_mission( - IN p_mission_id INT, - IN p_astronaut_id INT, - IN p_role VARCHAR(20) -) -BEGIN - -- Error handler: rollback on any error - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; -- propagate error after rollback - END; - START TRANSACTION; - -- Insert crew assignment - INSERT INTO mission_crew(mission_id, astronaut_id, role) - VALUES (p_mission_id, p_astronaut_id, p_role); - -- If role is Commander, update mission's commander_id (assign this astronaut as mission commander) - IF UPPER(p_role) = 'COMMANDER' THEN - UPDATE mission - SET commander_id = p_astronaut_id - WHERE id = p_mission_id; - END IF; - -- If astronaut has no first mission recorded, set it to this mission - IF (SELECT first_mission_id FROM astronaut WHERE id = p_astronaut_id) IS NULL THEN - UPDATE astronaut - SET first_mission_id = p_mission_id - WHERE id = p_astronaut_id; - END IF; - COMMIT; -END$$ - - - --- 4. Triggers - --- Trigger: Before inserting a mission crew record, enforce one commander and no crew on unmanned missions -CREATE TRIGGER trg_before_mission_crew_insert -BEFORE INSERT ON mission_crew -FOR EACH ROW -BEGIN - -- Ensure no duplicate commander assignment - IF NEW.role = 'Commander' THEN - DECLARE current_commander INT; - SELECT commander_id INTO current_commander FROM mission WHERE id = NEW.mission_id; - IF current_commander IS NOT NULL AND current_commander != NEW.astronaut_id THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Cannot assign a second commander to the mission'; - END IF; - END IF; - -- Prevent crew assignment to unmanned missions - IF (SELECT mission_type FROM mission WHERE id = NEW.mission_id) = 'Unmanned' THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Cannot assign crew to an unmanned mission'; - END IF; -END$$ - --- Trigger: After inserting a mission crew record, update mission commander and astronaut first mission if needed -CREATE TRIGGER trg_after_mission_crew_insert -AFTER INSERT ON mission_crew -FOR EACH ROW -BEGIN - -- If a commander was added to crew, ensure mission.commander_id is set to that astronaut - IF NEW.role = 'Commander' THEN - UPDATE mission - SET commander_id = NEW.astronaut_id - WHERE id = NEW.mission_id; - END IF; - -- If the astronaut has no first_mission recorded, set this mission as their first mission - IF (SELECT first_mission_id FROM astronaut WHERE id = NEW.astronaut_id) IS NULL THEN - UPDATE astronaut - SET first_mission_id = NEW.mission_id - WHERE id = NEW.astronaut_id; - END IF; -END$$ - --- Trigger: Before inserting a mission, ensure unmanned missions have no commander (commander_id should be NULL if unmanned) -CREATE TRIGGER trg_before_mission_insert -BEFORE INSERT ON mission -FOR EACH ROW -BEGIN - IF NEW.mission_type = 'Unmanned' AND NEW.commander_id IS NOT NULL THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Unmanned missions cannot have a commander'; - END IF; -END$$ - --- Trigger: After inserting a mission, log creation and auto-add commander to crew if provided -CREATE TRIGGER trg_after_mission_insert -AFTER INSERT ON mission -FOR EACH ROW -BEGIN - -- Log mission creation - INSERT INTO mission_log(mission_id, event) - VALUES (NEW.id, CONCAT('Mission "', NEW.name, '" created')); - -- If a commander was specified, automatically add them to mission_crew - IF NEW.commander_id IS NOT NULL THEN - INSERT IGNORE INTO mission_crew(mission_id, astronaut_id, role) - VALUES (NEW.id, NEW.commander_id, 'Commander'); - -- (INSERT IGNORE is used to avoid error if a record somehow already exists) - END IF; -END$$ - --- Trigger: After updating a mission, log status/commander changes and update spacecraft status -CREATE TRIGGER trg_after_mission_update -AFTER UPDATE ON mission -FOR EACH ROW -BEGIN - -- Log status change - IF NEW.status <> OLD.status THEN - INSERT INTO mission_log(mission_id, event) - VALUES (NEW.id, CONCAT('Mission status changed from ', OLD.status, ' to ', NEW.status)); - -- Update spacecraft status based on mission status changes - IF NEW.status = 'Active' THEN - UPDATE spacecraft - SET status = 'In Mission' - WHERE id = NEW.spacecraft_id; - ELSEIF NEW.status = 'Completed' THEN - UPDATE spacecraft - SET status = 'Operational', - last_mission_id = NEW.id - WHERE id = NEW.spacecraft_id; - ELSEIF NEW.status IN ('Failed','Aborted') THEN - UPDATE spacecraft - SET status = 'Lost', - last_mission_id = NEW.id - WHERE id = NEW.spacecraft_id; - END IF; - END IF; - -- Log commander change - IF NEW.commander_id <> OLD.commander_id THEN - IF NEW.commander_id IS NULL THEN - INSERT INTO mission_log(mission_id, event) - VALUES (NEW.id, 'Mission commander unassigned'); - ELSE - -- Fetch new commander's name for the log - INSERT INTO mission_log(mission_id, event) - VALUES (NEW.id, CONCAT('Commander changed to astronaut ID ', NEW.commander_id)); - -- (In practice, we might join astronaut for name, but for simplicity using ID) - END IF; - END IF; -END$$ - -DELIMITER ; - --- 5. Views - --- View: Mission Summary (combining details from multiple tables) -CREATE OR REPLACE VIEW v_mission_summary AS -SELECT - m.id AS mission_id, - m.name AS mission_name, - m.mission_type, - m.status, - m.launch_date, - m.return_date, - DATEDIFF(m.return_date, m.launch_date) AS duration_days, - cb.name AS destination_name, - ls.name AS launch_site_name, - sc.name AS spacecraft_name, - CONCAT(ascomm.first_name, ' ', ascomm.last_name) AS commander_name, - ag.name AS primary_agency, - -- subquery to count crew members on this mission - (SELECT COUNT(*) FROM mission_crew mc WHERE mc.mission_id = m.id) AS crew_count -FROM mission m -LEFT JOIN astronaut ascomm ON m.commander_id = ascomm.id -LEFT JOIN spacecraft sc ON m.spacecraft_id = sc.id -LEFT JOIN celestial_body cb ON m.destination_id = cb.id -LEFT JOIN launch_site ls ON m.launch_site_id = ls.id -LEFT JOIN agency ag ON m.primary_agency_id = ag.id; - --- View: Astronaut Stats (missions count and total days in space per astronaut) -CREATE OR REPLACE VIEW v_astronaut_stats AS -SELECT - a.id AS astronaut_id, - CONCAT(a.first_name, ' ', a.last_name) AS astronaut_name, - a.nationality, - a.status, - ag.name AS agency_name, - -- Count distinct missions (in case an astronaut had multiple roles in same mission, though our model prevents duplicates) - IFNULL(COUNT(DISTINCT mc.mission_id), 0) AS mission_count, - IFNULL(SUM(DATEDIFF(m.return_date, m.launch_date)), 0) AS total_days_in_space, - fm.name AS first_mission_name -FROM astronaut a -LEFT JOIN agency ag ON a.agency_id = ag.id -LEFT JOIN mission fm ON a.first_mission_id = fm.id -LEFT JOIN mission_crew mc ON a.id = mc.astronaut_id -LEFT JOIN mission m ON mc.mission_id = m.id AND m.return_date IS NOT NULL -- only count completed missions for days -GROUP BY a.id, a.first_name, a.last_name, a.nationality, a.status, ag.name, fm.name; @@ -381,12 +169,12 @@ GROUP BY a.id, a.first_name, a.last_name, a.nationality, a.status, ag.name, fm.n CREATE TABLE IF NOT EXISTS observatory ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, - agency_id INT NOT NULL, -- cross-schema reference to agency - launch_site_id INT NULL, -- optional link to launch_site if co-located - location_coord POINT NULL, -- optional spatial coordinate for ground location + agency_id INT NOT NULL, + launch_site_id INT NULL, + location_coord POINT NULL, status ENUM('Active','Under Maintenance','Retired') NOT NULL DEFAULT 'Active', CONSTRAINT uq_observatory_name UNIQUE (name) -) ENGINE=InnoDB; +); -- 2) TELESCOPE CREATE TABLE IF NOT EXISTS telescope ( @@ -394,46 +182,46 @@ CREATE TABLE IF NOT EXISTS telescope ( observatory_id INT NOT NULL, name VARCHAR(100) NOT NULL, telescope_type ENUM('Optical','Radio','Infrared','UV','X-Ray','Other') NOT NULL DEFAULT 'Optical', - mirror_diameter_m DOUBLE, -- diameter in meters + mirror_diameter_m DOUBLE, status ENUM('Operational','Damaged','Retired') DEFAULT 'Operational', CONSTRAINT uq_telescope_name UNIQUE (name) -) ENGINE=InnoDB; +); -- 3) INSTRUMENT CREATE TABLE IF NOT EXISTS instrument ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, instrument_type ENUM('Camera','Spectrometer','Sensor','Module','Other') NOT NULL, - telescope_id INT NULL, -- if installed on a telescope - spacecraft_id INT NULL, -- cross-schema reference to spacecraft + telescope_id INT NULL, + spacecraft_id INT NULL, status ENUM('Available','In Use','Damaged','Retired') DEFAULT 'Available', CONSTRAINT uq_instrument_name UNIQUE (name) -) ENGINE=InnoDB; +); -- 4) OBSERVATION_SESSION CREATE TABLE IF NOT EXISTS observation_session ( id INT AUTO_INCREMENT PRIMARY KEY, - telescope_id INT NULL, -- which telescope used - instrument_id INT NULL, -- which instrument used, if not the telescope alone - target_body_id INT NULL, -- cross-schema reference: celestial_body - mission_id INT NULL, -- cross-schema reference: mission (if part of a mission) + telescope_id INT NULL, + instrument_id INT NULL, + target_body_id INT NULL, + mission_id INT NULL, start_time DATETIME NOT NULL, end_time DATETIME NULL, seeing_conditions ENUM('Excellent','Good','Fair','Poor') DEFAULT 'Good', notes TEXT -) ENGINE=InnoDB; +); -- 5) DATA_SET CREATE TABLE IF NOT EXISTS data_set ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, - mission_id INT NULL, -- cross-schema reference: mission - observation_id INT NULL, -- reference cosmic_research.observation_session + mission_id INT NULL, + observation_id INT NULL, data_description TEXT, - data_blob LONGBLOB NULL, -- optional raw data + data_blob LONGBLOB NULL, collected_on DATE NOT NULL, CONSTRAINT uq_data_set_name UNIQUE (name) -) ENGINE=InnoDB; +); -- 6) RESEARCH_PAPER CREATE TABLE IF NOT EXISTS research_paper ( @@ -442,19 +230,19 @@ CREATE TABLE IF NOT EXISTS research_paper ( abstract TEXT, published_date DATE, doi VARCHAR(100), -- unique ID for academic papers - project_id INT NULL, -- cross-schema reference: research_project - observatory_id INT NULL, -- if the paper is from ground-based research + project_id INT NULL, + observatory_id INT NULL, CONSTRAINT uq_paper_doi UNIQUE (doi), FULLTEXT INDEX idx_paper_ft (title, abstract) -) ENGINE=InnoDB; +); -- 7) PAPER_CITATION CREATE TABLE IF NOT EXISTS paper_citation ( - citing_paper_id INT NOT NULL, -- referencing cosmic_research.research_paper - cited_paper_id INT NOT NULL, -- referencing cosmic_research.research_paper + citing_paper_id INT NOT NULL, + cited_paper_id INT NOT NULL, citation_date DATE NOT NULL, PRIMARY KEY (citing_paper_id, cited_paper_id) -) ENGINE=InnoDB; +); -- 8) GRANT CREATE TABLE IF NOT EXISTS `grant` ( @@ -466,32 +254,29 @@ CREATE TABLE IF NOT EXISTS `grant` ( end_date DATE NULL, status ENUM('Proposed','Awarded','Active','Closed','Canceled') NOT NULL DEFAULT 'Proposed', CONSTRAINT uq_grant_number UNIQUE (grant_number) -) ENGINE=InnoDB; +); -- 9) GRANT_RESEARCH_PROJECT CREATE TABLE IF NOT EXISTS grant_research_project ( grant_id INT NOT NULL, - research_project_id INT NOT NULL, -- cross-schema reference: research_project + research_project_id INT NOT NULL, allocated_amount DECIMAL(15,2), PRIMARY KEY (grant_id, research_project_id) -) ENGINE=InnoDB; +); -- 10) INSTRUMENT_USAGE CREATE TABLE IF NOT EXISTS instrument_usage ( id INT AUTO_INCREMENT PRIMARY KEY, instrument_id INT NOT NULL, - telescope_id INT NULL, -- if used on a telescope - spacecraft_id INT NULL, -- cross-schema reference: spacecraft + telescope_id INT NULL, + spacecraft_id INT NULL, start_date DATE NOT NULL, end_date DATE NULL, usage_notes TEXT -) ENGINE=InnoDB; +); SET FOREIGN_KEY_CHECKS=1; --- Now add the foreign keys referencing the original space schema and local references. --- NOTE: The exact schema name of the original DB is assumed to be `space`. --- Adjust if your actual schema name is different. ALTER TABLE observatory ADD CONSTRAINT fk_obs_agency @@ -622,7 +407,6 @@ ALTER TABLE instrument_usage -- Sample Constraints & Triggers for Additional Complexity -- --- Example CHECK constraints (MySQL 8+) ALTER TABLE telescope ADD CONSTRAINT chk_telescope_mirror CHECK ( (telescope_type IN ('Optical','Infrared','UV','X-Ray') AND mirror_diameter_m > 0) @@ -630,8 +414,7 @@ ALTER TABLE telescope OR (telescope_type = 'Other') ); --- Example trigger: Prevent new observation sessions on a retired telescope -DELIMITER $$ +-- DELIMITER $$ CREATE TRIGGER trg_before_observation_session_insert BEFORE INSERT ON observation_session FOR EACH ROW @@ -642,11 +425,10 @@ BEGIN SET MESSAGE_TEXT = 'Cannot create observation session on a retired telescope.'; END IF; END IF; -END$$ -DELIMITER ; +END; +-- DELIMITER ; --- Example stored procedure: awarding a grant -DELIMITER $$ +-- DELIMITER $$ CREATE PROCEDURE sp_award_grant( IN p_grant_id INT, IN p_start_date DATE, @@ -667,14 +449,12 @@ BEGIN end_date = p_end_date, funding_amount = p_amount WHERE id = p_grant_id; - - -- We could insert a log or do additional checks here... COMMIT; -END$$ -DELIMITER ; +END; +-- DELIMITER ; -- Example function: count citations of a research paper -DELIMITER $$ +-- DELIMITER $$ CREATE FUNCTION fn_paper_citation_count(p_paper_id INT) RETURNS INT DETERMINISTIC @@ -686,8 +466,8 @@ BEGIN FROM paper_citation WHERE cited_paper_id = p_paper_id; RETURN ccount; -END$$ -DELIMITER ; +END; +-- DELIMITER ; -- -- Example View: v_cross_schema_projects @@ -710,8 +490,55 @@ JOIN grant_research_project grp ON g.id = grp.grant_id JOIN research_project rp ON grp.research_project_id = rp.id LEFT JOIN agency s_ag ON g.agency_id = s_ag.id; +-- 5. Views + +-- View: Mission Summary (combining details from multiple tables) +CREATE OR REPLACE VIEW v_mission_summary AS +SELECT + m.id AS mission_id, + m.name AS mission_name, + m.mission_type, + m.status, + m.launch_date, + m.return_date, + DATEDIFF(m.return_date, m.launch_date) AS duration_days, + cb.name AS destination_name, + ls.name AS launch_site_name, + sc.name AS spacecraft_name, + CONCAT(ascomm.first_name, ' ', ascomm.last_name) AS commander_name, + ag.name AS primary_agency, + -- subquery to count crew members on this mission + (SELECT COUNT(*) FROM mission_crew mc WHERE mc.mission_id = m.id) AS crew_count +FROM mission m +LEFT JOIN astronaut ascomm ON m.commander_id = ascomm.id +LEFT JOIN spacecraft sc ON m.spacecraft_id = sc.id +LEFT JOIN celestial_body cb ON m.destination_id = cb.id +LEFT JOIN launch_site ls ON m.launch_site_id = ls.id +LEFT JOIN agency ag ON m.primary_agency_id = ag.id; + +-- View: Astronaut Stats (missions count and total days in space per astronaut) +CREATE OR REPLACE VIEW v_astronaut_stats AS +SELECT + a.id AS astronaut_id, + CONCAT(a.first_name, ' ', a.last_name) AS astronaut_name, + a.nationality, + a.status, + ag.name AS agency_name, + -- Count distinct missions (in case an astronaut had multiple roles in same mission, though our model prevents duplicates) + IFNULL(COUNT(DISTINCT mc.mission_id), 0) AS mission_count, + IFNULL(SUM(DATEDIFF(m.return_date, m.launch_date)), 0) AS total_days_in_space, + fm.name AS first_mission_name +FROM astronaut a +LEFT JOIN agency ag ON a.agency_id = ag.id +LEFT JOIN mission fm ON a.first_mission_id = fm.id +LEFT JOIN mission_crew mc ON a.id = mc.astronaut_id +LEFT JOIN mission m ON mc.mission_id = m.id AND m.return_date IS NOT NULL -- only count completed missions for days +GROUP BY a.id, a.first_name, a.last_name, a.nationality, a.status, ag.name, fm.name; + + + -DELIMITER $$ +-- DELIMITER $$ -- Stored Function: Mission duration in days CREATE FUNCTION mission_duration_days(p_mission_id INT) RETURNS INT @@ -729,11 +556,11 @@ BEGIN FROM mission WHERE id = p_mission_id; RETURN days; -END$$ +END; -DELIMITER ; +-- DELIMITER ; -DELIMITER $$ +-- DELIMITER $$ CREATE FUNCTION astronaut_mission_count(p_astro_id INT) RETURNS INT @@ -745,6 +572,166 @@ BEGIN FROM mission_crew WHERE astronaut_id = p_astro_id; RETURN IFNULL(m_count, 0); -END$$ +END; -DELIMITER ; +-- DELIMITER ; +-- Now, create a BEFORE INSERT trigger to enforce commander logic +-- DELIMITER $$ +CREATE TRIGGER trg_mission_commander_check +BEFORE INSERT ON mission +FOR EACH ROW +BEGIN + IF NEW.mission_type = 'Unmanned' AND NEW.commander_id IS NOT NULL THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Unmanned missions must not have a commander.'; + ELSEIF NEW.mission_type = 'Manned' AND NEW.commander_id IS NULL THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Manned missions must have a commander.'; + END IF; +END; +-- DELIMITER ; +-- 4. Triggers + +CREATE TRIGGER trg_before_mission_crew_insert +BEFORE INSERT ON mission_crew +FOR EACH ROW +BEGIN + DECLARE current_commander INT; + + -- Ensure no duplicate commander assignment + IF NEW.role = 'Commander' THEN + SELECT commander_id INTO current_commander + FROM mission + WHERE id = NEW.mission_id; + IF current_commander IS NOT NULL AND current_commander != NEW.astronaut_id THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Cannot assign a second commander to the mission'; + END IF; + END IF; + + -- Prevent crew assignment to unmanned missions + IF (SELECT mission_type FROM mission WHERE id = NEW.mission_id) = 'Unmanned' THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Cannot assign crew to an unmanned mission'; + END IF; +END; +-- Trigger: After inserting a mission crew record, update mission commander and astronaut first mission if needed +CREATE TRIGGER trg_after_mission_crew_insert +AFTER INSERT ON mission_crew +FOR EACH ROW +BEGIN + -- If a commander was added to crew, ensure mission.commander_id is set to that astronaut + IF NEW.role = 'Commander' THEN + UPDATE mission + SET commander_id = NEW.astronaut_id + WHERE id = NEW.mission_id; + END IF; + -- If the astronaut has no first_mission recorded, set this mission as their first mission + IF (SELECT first_mission_id FROM astronaut WHERE id = NEW.astronaut_id) IS NULL THEN + UPDATE astronaut + SET first_mission_id = NEW.mission_id + WHERE id = NEW.astronaut_id; + END IF; +END; + +-- Trigger: Before inserting a mission, ensure unmanned missions have no commander (commander_id should be NULL if unmanned) +CREATE TRIGGER trg_before_mission_insert +BEFORE INSERT ON mission +FOR EACH ROW +BEGIN + IF NEW.mission_type = 'Unmanned' AND NEW.commander_id IS NOT NULL THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Unmanned missions cannot have a commander'; + END IF; +END; + +-- Trigger: After inserting a mission, log creation and auto-add commander to crew if provided +CREATE TRIGGER trg_after_mission_insert +AFTER INSERT ON mission +FOR EACH ROW +BEGIN + -- Log mission creation + INSERT INTO mission_log(mission_id, event) + VALUES (NEW.id, CONCAT('Mission "', NEW.name, '" created')); + -- If a commander was specified, automatically add them to mission_crew + IF NEW.commander_id IS NOT NULL THEN + INSERT IGNORE INTO mission_crew(mission_id, astronaut_id, role) + VALUES (NEW.id, NEW.commander_id, 'Commander'); + END IF; +END; + +-- Trigger: After updating a mission, log status/commander changes and update spacecraft status +CREATE TRIGGER trg_after_mission_update +AFTER UPDATE ON mission +FOR EACH ROW +BEGIN + -- Log status change + IF NEW.status <> OLD.status THEN + INSERT INTO mission_log(mission_id, event) + VALUES (NEW.id, CONCAT('Mission status changed from ', OLD.status, ' to ', NEW.status)); + -- Update spacecraft status based on mission status changes + IF NEW.status = 'Active' THEN + UPDATE spacecraft + SET status = 'In Mission' + WHERE id = NEW.spacecraft_id; + ELSEIF NEW.status = 'Completed' THEN + UPDATE spacecraft + SET status = 'Operational', + last_mission_id = NEW.id + WHERE id = NEW.spacecraft_id; + ELSEIF NEW.status IN ('Failed','Aborted') THEN + UPDATE spacecraft + SET status = 'Lost', + last_mission_id = NEW.id + WHERE id = NEW.spacecraft_id; + END IF; + END IF; + -- Log commander change + IF NEW.commander_id <> OLD.commander_id THEN + IF NEW.commander_id IS NULL THEN + INSERT INTO mission_log(mission_id, event) + VALUES (NEW.id, 'Mission commander unassigned'); + ELSE + -- Fetch new commander's name for the log + INSERT INTO mission_log(mission_id, event) + VALUES (NEW.id, CONCAT('Commander changed to astronaut ID ', NEW.commander_id)); + END IF; + END IF; +END; + +-- DELIMITER ; +-- 3. Stored Procedures and Functions + +-- DELIMITER $$ + +-- Stored Procedure: Assign an astronaut to a mission with a given role (with transaction) +CREATE PROCEDURE assign_astronaut_to_mission( + IN p_mission_id INT, + IN p_astronaut_id INT, + IN p_role VARCHAR(20) +) +BEGIN + -- Error handler: rollback on any error + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + START TRANSACTION; + -- Insert crew assignment + INSERT INTO mission_crew(mission_id, astronaut_id, role) + VALUES (p_mission_id, p_astronaut_id, p_role); + -- If role is Commander, update mission's commander_id (assign this astronaut as mission commander) + IF UPPER(p_role) = 'COMMANDER' THEN + UPDATE mission + SET commander_id = p_astronaut_id + WHERE id = p_mission_id; + END IF; + -- If astronaut has no first mission recorded, set it to this mission + IF (SELECT first_mission_id FROM astronaut WHERE id = p_astronaut_id) IS NULL THEN + UPDATE astronaut + SET first_mission_id = p_mission_id + WHERE id = p_astronaut_id; + END IF; + COMMIT; +END; diff --git a/internal/testutil/testdata/mysql/complex/inserts.sql b/internal/testutil/testdata/mysql/complex/inserts.sql new file mode 100644 index 0000000000..e69de29bb2 diff --git a/internal/testutil/testdata/mysql/complex/job-mappings.go b/internal/testutil/testdata/mysql/complex/job-mappings.go new file mode 100644 index 0000000000..a5aaa79426 --- /dev/null +++ b/internal/testutil/testdata/mysql/complex/job-mappings.go @@ -0,0 +1,2082 @@ + +// Code generated by Neosync jobmapping_generator. DO NOT EDIT. +// source: create-tables.sql + +package mysql_complex + +import ( + mgmtv1alpha1 "github.com/nucleuscloud/neosync/backend/gen/go/protos/mgmt/v1alpha1" +) + +func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { + return []*mgmtv1alpha1.JobMapping{ + { + Schema: schema, + Table: "agency", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "agency", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "agency", + Column: "country", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "agency", + Column: "founded_year", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "agency", + Column: "INDEX", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "first_name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "last_name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "birth_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "nationality", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "status", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "agency_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "first_mission_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "astronaut", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "body_type", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "mass", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "radius", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "parent_body_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "celestial_body", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "data_set", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "data_set", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "data_set", + Column: "mission_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "data_set", + Column: "observation_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "data_set", + Column: "data_description", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "data_set", + Column: "data_blob", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "data_set", + Column: "collected_on", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant_research_project", + Column: "grant_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant_research_project", + Column: "research_project_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant_research_project", + Column: "allocated_amount", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument", + Column: "instrument_type", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument", + Column: "telescope_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument", + Column: "spacecraft_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument", + Column: "status", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument_usage", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument_usage", + Column: "instrument_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument_usage", + Column: "telescope_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument_usage", + Column: "spacecraft_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument_usage", + Column: "start_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument_usage", + Column: "end_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "instrument_usage", + Column: "usage_notes", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "launch_site", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "launch_site", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "launch_site", + Column: "location", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "launch_site", + Column: "location_coord", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "launch_site", + Column: "country", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "launch_site", + Column: "SPATIAL", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "mission_code", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "mission_type", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "status", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "launch_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "return_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "spacecraft_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "destination_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "launch_site_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "primary_agency_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "commander_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "mission_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "astronaut_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "role", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_crew", + Column: "INDEX", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_log", + Column: "log_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_log", + Column: "mission_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_log", + Column: "log_time", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_log", + Column: "event", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_log", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_log", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_log", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "mission_log", + Column: "INDEX", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "telescope_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "instrument_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "target_body_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "mission_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "start_time", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "end_time", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "seeing_conditions", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observation_session", + Column: "notes", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observatory", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observatory", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observatory", + Column: "agency_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observatory", + Column: "launch_site_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observatory", + Column: "location_coord", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "observatory", + Column: "status", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "paper_citation", + Column: "citing_paper_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "paper_citation", + Column: "cited_paper_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "paper_citation", + Column: "citation_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "project_mission", + Column: "project_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "project_mission", + Column: "mission_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "project_mission", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "project_mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "project_mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "project_mission", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "project_mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "project_mission", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_paper", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_paper", + Column: "title", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_paper", + Column: "abstract", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_paper", + Column: "published_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_paper", + Column: "doi", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_paper", + Column: "project_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_paper", + Column: "observatory_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_paper", + Column: "FULLTEXT", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "title", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "description", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "start_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "end_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "lead_astronaut_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "research_project", + Column: "FULLTEXT", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "type", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "capacity", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "status", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "agency_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "last_mission_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "FOREIGN", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "spacecraft", + Column: "ON", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "telescope", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "telescope", + Column: "observatory_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "telescope", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "telescope", + Column: "telescope_type", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "telescope", + Column: "mirror_diameter_m", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "telescope", + Column: "status", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + } +} + From aab294ba9539a2d0df6f3bff3d7faa5da324670a Mon Sep 17 00:00:00 2001 From: Alisha Date: Mon, 10 Mar 2025 17:21:32 -0700 Subject: [PATCH 3/5] fix indexes --- .../gen/go/db/dbschemas/mysql/system.sql.go | 24 +- .../go/db/dbschemas/postgresql/system.sql.go | 4 +- .../dbschemas/sql/mysql/queries/system.sql | 25 +- backend/pkg/sqlmanager/mysql/mysql-manager.go | 96 ++- .../worker/workflow/mysql_test.go | 47 +- .../testdata/mysql/complex/create-tables.sql | 33 - .../testdata/mysql/complex/inserts.sql | 574 ++++++++++++++++++ .../testdata/mysql/complex/job-mappings.go | 91 +++ 8 files changed, 794 insertions(+), 100 deletions(-) diff --git a/backend/gen/go/db/dbschemas/mysql/system.sql.go b/backend/gen/go/db/dbschemas/mysql/system.sql.go index bfe48327bd..41dc5ae294 100644 --- a/backend/gen/go/db/dbschemas/mysql/system.sql.go +++ b/backend/gen/go/db/dbschemas/mysql/system.sql.go @@ -318,7 +318,7 @@ func (q *Queries) GetDatabaseTableSchemasBySchemasAndTables(ctx context.Context, } const getIndicesBySchemasAndTables = `-- name: GetIndicesBySchemasAndTables :many -SELECT +SELECT s.TABLE_SCHEMA as schema_name, s.TABLE_NAME as table_name, s.COLUMN_NAME as column_name, @@ -327,18 +327,16 @@ SELECT s.INDEX_TYPE as index_type, s.SEQ_IN_INDEX as seq_in_index, s.NULLABLE as nullable -FROM - INFORMATION_SCHEMA.STATISTICS s -LEFT JOIN - INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu - ON s.TABLE_SCHEMA = kcu.CONSTRAINT_SCHEMA - AND s.TABLE_NAME = kcu.TABLE_NAME - AND s.COLUMN_NAME = kcu.COLUMN_NAME -WHERE - s.TABLE_SCHEMA = ? AND s.TABLE_NAME in (/*SLICE:tables*/?) - AND s.INDEX_NAME != 'PRIMARY' - AND kcu.CONSTRAINT_NAME IS NULL -ORDER BY +FROM information_schema.statistics s +LEFT JOIN information_schema.table_constraints tc + ON s.TABLE_SCHEMA = tc.TABLE_SCHEMA + AND s.TABLE_NAME = tc.TABLE_NAME + AND s.INDEX_NAME = tc.CONSTRAINT_NAME +WHERE + s.TABLE_SCHEMA = ? + AND s.TABLE_NAME in (/*SLICE:tables*/?) + AND tc.CONSTRAINT_NAME IS NULL -- filters out other constraints (foreign keys, unique, primary keys, etc) +ORDER BY s.TABLE_NAME, s.INDEX_NAME, s.SEQ_IN_INDEX diff --git a/backend/gen/go/db/dbschemas/postgresql/system.sql.go b/backend/gen/go/db/dbschemas/postgresql/system.sql.go index a65f3575b2..a3088012da 100644 --- a/backend/gen/go/db/dbschemas/postgresql/system.sql.go +++ b/backend/gen/go/db/dbschemas/postgresql/system.sql.go @@ -513,7 +513,7 @@ column_defaults AS ( AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind IN ('r', 'p') - -- exclude partitions + -- exclude child partitions AND c.relispartition = FALSE ), identity_columns AS ( @@ -713,7 +713,7 @@ column_defaults AS ( AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind IN ('r', 'p') - -- exclude partitions + -- exclude child partitions AND c.relispartition = FALSE ), identity_columns AS ( diff --git a/backend/pkg/dbschemas/sql/mysql/queries/system.sql b/backend/pkg/dbschemas/sql/mysql/queries/system.sql index 48693027bd..5cc74a187d 100644 --- a/backend/pkg/dbschemas/sql/mysql/queries/system.sql +++ b/backend/pkg/dbschemas/sql/mysql/queries/system.sql @@ -211,7 +211,7 @@ ORDER BY -- name: GetIndicesBySchemasAndTables :many -SELECT +SELECT s.TABLE_SCHEMA as schema_name, s.TABLE_NAME as table_name, s.COLUMN_NAME as column_name, @@ -220,23 +220,22 @@ SELECT s.INDEX_TYPE as index_type, s.SEQ_IN_INDEX as seq_in_index, s.NULLABLE as nullable -FROM - INFORMATION_SCHEMA.STATISTICS s -LEFT JOIN - INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu - ON s.TABLE_SCHEMA = kcu.CONSTRAINT_SCHEMA - AND s.TABLE_NAME = kcu.TABLE_NAME - AND s.COLUMN_NAME = kcu.COLUMN_NAME -WHERE - s.TABLE_SCHEMA = sqlc.arg('schema') AND s.TABLE_NAME in (sqlc.slice('tables')) - AND s.INDEX_NAME != 'PRIMARY' - AND kcu.CONSTRAINT_NAME IS NULL -ORDER BY +FROM information_schema.statistics s +LEFT JOIN information_schema.table_constraints tc + ON s.TABLE_SCHEMA = tc.TABLE_SCHEMA + AND s.TABLE_NAME = tc.TABLE_NAME + AND s.INDEX_NAME = tc.CONSTRAINT_NAME +WHERE + s.TABLE_SCHEMA = sqlc.arg('schema') + AND s.TABLE_NAME in (sqlc.slice('tables')) + AND tc.CONSTRAINT_NAME IS NULL -- filters out other constraints (foreign keys, unique, primary keys, etc) +ORDER BY s.TABLE_NAME, s.INDEX_NAME, s.SEQ_IN_INDEX; + -- name: GetCustomFunctionsBySchemas :many SELECT ROUTINE_NAME as function_name, diff --git a/backend/pkg/sqlmanager/mysql/mysql-manager.go b/backend/pkg/sqlmanager/mysql/mysql-manager.go index 6dd8e52796..beab17e881 100644 --- a/backend/pkg/sqlmanager/mysql/mysql-manager.go +++ b/backend/pkg/sqlmanager/mysql/mysql-manager.go @@ -296,6 +296,12 @@ func (m *MysqlManager) GetRolePermissionsMap(ctx context.Context) (map[string][] return schemaTablePrivsMap, err } +type indexInfo struct { + indexName string + indexType string + columns []string +} + func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) ([]*sqlmanager_shared.TableInitStatement, error) { if len(tables) == 0 { return []*sqlmanager_shared.TableInitStatement{}, nil @@ -351,7 +357,44 @@ func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*sql }) } - indexmap := map[string]map[string][]string{} + // indexmap := map[string]map[string][]string{} + // var indexMapMu sync.Mutex + // for schema, tables := range schemaset { + // errgrp.Go(func() error { + // idxrecords, err := m.querier.GetIndicesBySchemasAndTables(errctx, m.pool, &mysql_queries.GetIndicesBySchemasAndTablesParams{ + // Schema: schema, + // Tables: tables, + // }) + // if err != nil { + // return fmt.Errorf("failed to build mysql indices by schemas and tables: %w", err) + // } + + // indexMapMu.Lock() + // defer indexMapMu.Unlock() + // for _, record := range idxrecords { + // key := sqlmanager_shared.SchemaTable{Schema: record.SchemaName, Table: record.TableName} + // if _, exists := indexmap[key.String()]; !exists { + // indexmap[key.String()] = make(map[string][]string) + // } + // // Group columns/expressions by index name + // if record.ColumnName.Valid { + // indexmap[key.String()][record.IndexName] = append( + // indexmap[key.String()][record.IndexName], + // record.ColumnName.String, + // ) + // } else if record.Expression.Valid { + // indexmap[key.String()][record.IndexName] = append( + // indexmap[key.String()][record.IndexName], + // // expressions must be wrapped in parentheses on creation, but don't come out of the DB in that format /shrug + // fmt.Sprintf("(%s)", record.Expression.String), + // ) + // } + // } + // return nil + // }) + // } + + indexmap := map[string]map[string]*indexInfo{} var indexMapMu sync.Mutex for schema, tables := range schemaset { errgrp.Go(func() error { @@ -368,17 +411,31 @@ func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*sql for _, record := range idxrecords { key := sqlmanager_shared.SchemaTable{Schema: record.SchemaName, Table: record.TableName} if _, exists := indexmap[key.String()]; !exists { - indexmap[key.String()] = make(map[string][]string) + indexmap[key.String()] = make(map[string]*indexInfo) // Adjusted to map to *indexInfo } // Group columns/expressions by index name if record.ColumnName.Valid { - indexmap[key.String()][record.IndexName] = append( - indexmap[key.String()][record.IndexName], + if _, exists := indexmap[key.String()][record.IndexName]; !exists { + indexmap[key.String()][record.IndexName] = &indexInfo{ // Initialize indexInfo + indexName: record.IndexName, + indexType: record.IndexType, + columns: []string{}, + } + } + indexmap[key.String()][record.IndexName].columns = append( + indexmap[key.String()][record.IndexName].columns, record.ColumnName.String, ) } else if record.Expression.Valid { - indexmap[key.String()][record.IndexName] = append( - indexmap[key.String()][record.IndexName], + if _, exists := indexmap[key.String()][record.IndexName]; !exists { + indexmap[key.String()][record.IndexName] = &indexInfo{ // Initialize indexInfo + indexName: record.IndexName, + indexType: record.IndexType, + columns: []string{}, + } + } + indexmap[key.String()][record.IndexName].columns = append( + indexmap[key.String()][record.IndexName].columns, // expressions must be wrapped in parentheses on creation, but don't come out of the DB in that format /shrug fmt.Sprintf("(%s)", record.Expression.String), ) @@ -451,10 +508,10 @@ func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*sql info.AlterTableStatements = append(info.AlterTableStatements, stmt) } if tableIndices, ok := indexmap[key]; ok { - for idxName, cols := range tableIndices { + for _, idxInfo := range tableIndices { info.IndexStatements = append( info.IndexStatements, - wrapIdempotentIndex(schematable.Schema, schematable.Table, idxName, cols), + wrapIdempotentIndex(schematable.Schema, schematable.Table, idxInfo), ) } } @@ -777,17 +834,23 @@ func hashInput(input ...string) string { return hex.EncodeToString(hasher.Sum(nil)) } +func createIndexStmt(schema, table string, idxInfo *indexInfo, columnInput []string) string { + if strings.EqualFold(idxInfo.indexType, "spatial") || strings.EqualFold(idxInfo.indexType, "fulltext") { + return fmt.Sprintf("ALTER TABLE %s.%s ADD %s INDEX %s (%s);", EscapeMysqlColumn(schema), EscapeMysqlColumn(table), idxInfo.indexType, EscapeMysqlColumn(idxInfo.indexName), strings.Join(columnInput, ", ")) + } + return fmt.Sprintf("ALTER TABLE %s.%s ADD INDEX %s (%s) USING %s;", EscapeMysqlColumn(schema), EscapeMysqlColumn(table), EscapeMysqlColumn(idxInfo.indexName), strings.Join(columnInput, ", "), idxInfo.indexType) +} + func wrapIdempotentIndex( schema, - table, - constraintname string, - cols []string, + table string, + idxInfo *indexInfo, ) string { - hashParams := []string{schema, table, constraintname} - hashParams = append(hashParams, cols...) + hashParams := []string{schema, table, idxInfo.indexName} + hashParams = append(hashParams, idxInfo.columns...) columnInput := []string{} - for _, col := range cols { + for _, col := range idxInfo.columns { if strings.HasPrefix(col, "(") { columnInput = append(columnInput, col) } else { @@ -795,6 +858,7 @@ func wrapIdempotentIndex( } } procedureName := fmt.Sprintf("NeosyncAddIndex_%s", hashInput(hashParams...))[:64] + indexStmt := createIndexStmt(schema, table, idxInfo, columnInput) stmt := fmt.Sprintf(` CREATE PROCEDURE %[1]s() BEGIN @@ -807,13 +871,13 @@ BEGIN AND index_name = '%[4]s'; IF index_exists = 0 THEN - CREATE INDEX %[5]s ON %[6]s.%[7]s(%[8]s); + %s END IF; END; CALL %[1]s(); DROP PROCEDURE %[1]s; -`, procedureName, schema, table, constraintname, EscapeMysqlColumn(constraintname), EscapeMysqlColumn(schema), EscapeMysqlColumn(table), strings.Join(columnInput, ", ")) +`, procedureName, schema, table, idxInfo.indexName, indexStmt) return strings.TrimSpace(stmt) } diff --git a/internal/integration-tests/worker/workflow/mysql_test.go b/internal/integration-tests/worker/workflow/mysql_test.go index 98dcb31828..70da7dc3ce 100644 --- a/internal/integration-tests/worker/workflow/mysql_test.go +++ b/internal/integration-tests/worker/workflow/mysql_test.go @@ -18,6 +18,7 @@ import ( mysql_composite_keys "github.com/nucleuscloud/neosync/internal/testutil/testdata/mysql/composite-keys" mysql_edgecases "github.com/nucleuscloud/neosync/internal/testutil/testdata/mysql/edgecases" mysql_human_resources "github.com/nucleuscloud/neosync/internal/testutil/testdata/mysql/humanresources" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) @@ -426,7 +427,7 @@ func test_mysql_complex( jobclient := neosyncApi.OSSUnauthenticatedLicensedClients.Jobs() schema := "complex" - err := mysql.Source.RunCreateStmtsInDatabase(ctx, mysqlTestdataFolder, []string{"complex/create-tables.sql"}, schema) + err := mysql.Source.RunCreateStmtsInDatabase(ctx, mysqlTestdataFolder, []string{"complex/create-tables.sql", "complex/inserts.sql"}, schema) require.NoError(t, err) neosyncApi.MockTemporalForCreateJob("test-mysql-sync") @@ -446,7 +447,7 @@ func test_mysql_complex( }, }) - testworkflow := NewTestDataSyncWorkflowEnv(t, neosyncApi, dbManagers) + testworkflow := NewTestDataSyncWorkflowEnv(t, neosyncApi, dbManagers, WithMaxIterations(10), WithPageLimit(100)) testworkflow.RequireActivitiesCompletedSuccessfully(t) testworkflow.ExecuteTestDataSyncWorkflow(job.GetId()) require.Truef(t, testworkflow.TestEnv.IsWorkflowCompleted(), "Workflow did not complete. Test: mysql_complex") @@ -458,32 +459,32 @@ func test_mysql_complex( table string rowCount int }{ - {schema, "agency", 0}, - {schema, "astronaut", 0}, - {schema, "spacecraft", 0}, - {schema, "celestial_body", 0}, - {schema, "launch_site", 0}, - {schema, "mission", 0}, - {schema, "mission_crew", 0}, - {schema, "research_project", 0}, - {schema, "project_mission", 0}, - {schema, "mission_log", 0}, - {schema, "observatory", 0}, - {schema, "telescope", 0}, - {schema, "instrument", 0}, - {schema, "observation_session", 0}, - {schema, "data_set", 0}, - {schema, "research_paper", 0}, - {schema, "paper_citation", 0}, - {schema, "grant", 0}, - {schema, "grant_research_project", 0}, - {schema, "instrument_usage", 0}, + {schema, "agency", 20}, + {schema, "astronaut", 20}, + {schema, "spacecraft", 20}, + {schema, "celestial_body", 20}, + {schema, "launch_site", 20}, + {schema, "mission", 20}, + {schema, "mission_crew", 20}, + {schema, "research_project", 20}, + {schema, "project_mission", 20}, + {schema, "mission_log", 20}, + {schema, "observatory", 20}, + {schema, "telescope", 21}, + {schema, "instrument", 20}, + {schema, "observation_session", 20}, + {schema, "data_set", 20}, + {schema, "research_paper", 20}, + {schema, "paper_citation", 20}, + {schema, "grant", 20}, + {schema, "grant_research_project", 20}, + {schema, "instrument_usage", 20}, } for _, expected := range expectedResults { rowCount, err := mysql.Target.GetTableRowCount(ctx, expected.schema, expected.table) require.NoError(t, err) - require.Equalf(t, expected.rowCount, rowCount, fmt.Sprintf("Test: mysql_complex Table: %s", expected.table)) + assert.Equalf(t, expected.rowCount, rowCount, fmt.Sprintf("Test: mysql_complex Table: %s", expected.table)) } // tear down diff --git a/internal/testutil/testdata/mysql/complex/create-tables.sql b/internal/testutil/testdata/mysql/complex/create-tables.sql index bbd10e4373..3874fd522b 100644 --- a/internal/testutil/testdata/mysql/complex/create-tables.sql +++ b/internal/testutil/testdata/mysql/complex/create-tables.sql @@ -574,24 +574,6 @@ BEGIN RETURN IFNULL(m_count, 0); END; --- DELIMITER ; --- Now, create a BEFORE INSERT trigger to enforce commander logic --- DELIMITER $$ -CREATE TRIGGER trg_mission_commander_check -BEFORE INSERT ON mission -FOR EACH ROW -BEGIN - IF NEW.mission_type = 'Unmanned' AND NEW.commander_id IS NOT NULL THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Unmanned missions must not have a commander.'; - ELSEIF NEW.mission_type = 'Manned' AND NEW.commander_id IS NULL THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Manned missions must have a commander.'; - END IF; -END; --- DELIMITER ; --- 4. Triggers - CREATE TRIGGER trg_before_mission_crew_insert BEFORE INSERT ON mission_crew FOR EACH ROW @@ -645,21 +627,6 @@ BEGIN END IF; END; --- Trigger: After inserting a mission, log creation and auto-add commander to crew if provided -CREATE TRIGGER trg_after_mission_insert -AFTER INSERT ON mission -FOR EACH ROW -BEGIN - -- Log mission creation - INSERT INTO mission_log(mission_id, event) - VALUES (NEW.id, CONCAT('Mission "', NEW.name, '" created')); - -- If a commander was specified, automatically add them to mission_crew - IF NEW.commander_id IS NOT NULL THEN - INSERT IGNORE INTO mission_crew(mission_id, astronaut_id, role) - VALUES (NEW.id, NEW.commander_id, 'Commander'); - END IF; -END; - -- Trigger: After updating a mission, log status/commander changes and update spacecraft status CREATE TRIGGER trg_after_mission_update AFTER UPDATE ON mission diff --git a/internal/testutil/testdata/mysql/complex/inserts.sql b/internal/testutil/testdata/mysql/complex/inserts.sql index e69de29bb2..5fc8eb4f62 100644 --- a/internal/testutil/testdata/mysql/complex/inserts.sql +++ b/internal/testutil/testdata/mysql/complex/inserts.sql @@ -0,0 +1,574 @@ +SET FOREIGN_KEY_CHECKS=0; +-- ============================= +-- 1) AGENCY (no dependencies) +-- ============================= +INSERT INTO agency (name, country, founded_year) +VALUES +('NASA','USA',1958), +('ESA','Multinational',1975), +('Roscosmos','Russia',1992), +('CNSA','China',1993), +('JAXA','Japan',2003), +('ISRO','India',1969), +('SpaceX','USA',2002), +('Blue Origin','USA',2000), +('Rocket Lab','USA/NZ',2006), +('Arianespace','France',1980), +('CSA','Canada',1989), +('DLR','Germany',1997), +('UKSA','United Kingdom',2010), +('CNES','France',1961), +('ASI','Italy',1988), +('Inmarsat','United Kingdom',1979), +('KARI','South Korea',1989), +('UAE Space Agency','UAE',2014), +('Iran Space Agency','Iran',2004), +('Luxembourg Space Agency','Luxembourg',2018); + +-- ========================================================= +-- 2) CELESTIAL_BODY (self-reference via parent_body_id) +-- The first inserted row will get ID=1, second => ID=2, etc. +-- ========================================================= +INSERT INTO celestial_body (name, body_type, mass, radius, parent_body_id) +VALUES +('Sun','Star',1.989e30,695700,NULL), -- ID=1 (no parent) +('Mercury','Planet',3.301e23,2439.7,1), -- ID=2 (parent=Sun) +('Venus','Planet',4.867e24,6051.8,1), -- ID=3 +('Earth','Planet',5.972e24,6371,1), -- ID=4 +('Mars','Planet',6.417e23,3389.5,1), -- ID=5 +('Jupiter','Planet',1.898e27,69911,1), -- ID=6 +('Saturn','Planet',5.683e26,58232,1), -- ID=7 +('Uranus','Planet',8.681e25,25362,1), -- ID=8 +('Neptune','Planet',1.024e26,24622,1), -- ID=9 +('Pluto','Dwarf Planet',1.303e22,1188.3,1), -- ID=10 +('Moon','Moon',7.3477e22,1737.4,4), -- ID=11 (parent=Earth) +('Phobos','Moon',1.07e16,11.2667,5), -- ID=12 (parent=Mars) +('Deimos','Moon',1.80e15,6.2,5), -- ID=13 +('Ganymede','Moon',1.495e23,2634.1,6), -- ID=14 +('Callisto','Moon',1.075e23,2410.3,6), -- ID=15 +('Titan','Moon',1.345e23,2575.5,7), -- ID=16 +('Enceladus','Moon',1.08e20,252.1,7), -- ID=17 +('Europa','Moon',4.80e22,1560.8,6), -- ID=18 +('Halley','Comet',2.2e14,11.0,1), -- ID=19 +('Ceres','Dwarf Planet',9.39e20,473,1); -- ID=20 + +-- =========================================== +-- 3) LAUNCH_SITE (no references to other new tables) +-- but has a spatial POINT column +-- =========================================== +INSERT INTO launch_site (name, location, location_coord, country) +VALUES +('Cape Canaveral LC-39A','Florida, USA', ST_GeomFromText('POINT(-80.6042 28.6084)'), 'USA'), +('Cape Canaveral LC-40','Florida, USA', ST_GeomFromText('POINT(-80.6019 28.5614)'), 'USA'), +('Vandenberg SLC-4E','California, USA', ST_GeomFromText('POINT(-120.6106 34.6321)'), 'USA'), +('Vandenberg SLC-4W','California, USA', ST_GeomFromText('POINT(-120.6136 34.6331)'), 'USA'), +('Baikonur Cosmodrome','Baikonur, Kazakhstan', ST_GeomFromText('POINT(63.3422 45.9206)'), 'Kazakhstan'), +('Plesetsk Cosmodrome','Plesetsk, Russia', ST_GeomFromText('POINT(40.6469 62.9270)'), 'Russia'), +('Guiana Space Centre ELA-3','Kourou, French Guiana', ST_GeomFromText('POINT(-52.7750 5.2360)'), 'France'), +('Guiana Space Centre ELS','Kourou, French Guiana', ST_GeomFromText('POINT(-52.7685 5.2220)'), 'France'), +('Jiuquan SLS-2','Jiuquan, China', ST_GeomFromText('POINT(100.2916 40.9583)'), 'China'), +('Satish Dhawan SLP','Sriharikota, India', ST_GeomFromText('POINT(80.2300 13.7330)'), 'India'), +('Tanegashima Yoshinobu','Tanegashima, Japan', ST_GeomFromText('POINT(130.966 30.405)'), 'Japan'), +('Wenchang LC-101','Wenchang, China', ST_GeomFromText('POINT(110.951 19.614)'), 'China'), +('Kennedy LC-39B','Florida, USA', ST_GeomFromText('POINT(-80.6215 28.6270)'), 'USA'), +('Blue Origin Launch Site One','West Texas, USA', ST_GeomFromText('POINT(-104.757 31.400)'), 'USA'), +('Rocket Lab Launch Complex 1','Mahia Peninsula, NZ', ST_GeomFromText('POINT(177.864 -39.262)'), 'New Zealand'), +('Kodiak Launch Complex','Alaska, USA', ST_GeomFromText('POINT(-152.337 57.436)'), 'USA'), +('JAXA Uchinoura','Kagoshima, Japan', ST_GeomFromText('POINT(131.079 31.251)'), 'Japan'), +('Palmachim','Palmachim, Israel', ST_GeomFromText('POINT(34.700 31.900)'), 'Israel'), +('Xichang','Xichang, China', ST_GeomFromText('POINT(102.025 28.246)'), 'China'), +('Alcantara','Alcantara, Brazil', ST_GeomFromText('POINT(-44.396 2.307)'), 'Brazil'); + +-- ========================================================== +-- 4) OBSERVATORY (references agency.id, launch_site.id) +-- Some will have launch_site_id = NULL +-- ========================================================== +INSERT INTO observatory (name, agency_id, launch_site_id, location_coord, status) +VALUES +('Kitt Peak National Observatory', 1, NULL, ST_GeomFromText('POINT(-111.6003 31.9583)'), 'Active'), +('Paranal Observatory', 2, NULL, ST_GeomFromText('POINT(-70.4030 -24.6252)'), 'Active'), +('La Silla Observatory', 2, NULL, ST_GeomFromText('POINT(-70.7345 -29.2570)'), 'Active'), +('Very Large Array', 1, NULL, ST_GeomFromText('POINT(-107.6184 34.0784)'), 'Under Maintenance'), +('Mount Wilson Observatory', 1, NULL, ST_GeomFromText('POINT(-118.0662 34.2242)'), 'Active'), +('Guiana Space Centre Observatory', 10, 7, ST_GeomFromText('POINT(-52.7670 5.2320)'), 'Active'), +('Baikonur Observatory', 3, 5, ST_GeomFromText('POINT(63.3425 45.9210)'), 'Active'), +('Jiuquan Observatory', 4, 9, ST_GeomFromText('POINT(100.2890 40.9600)'), 'Active'), +('Satish Dhawan Observatory', 6, 10, ST_GeomFromText('POINT(80.2310 13.7340)'), 'Active'), +('Tanegashima Observatory', 5, 11, ST_GeomFromText('POINT(130.970 30.403)'), 'Active'), +('Vandenberg Observatory', 1, 3, ST_GeomFromText('POINT(-120.6110 34.6300)'), 'Active'), +('Wenchang Observatory', 4, 12, ST_GeomFromText('POINT(110.950 19.615)'), 'Active'), +('Kennedy Observatory', 1, 13, ST_GeomFromText('POINT(-80.6200 28.6260)'), 'Under Maintenance'), +('Blue Origin Observatory', 8, 14, NULL, 'Active'), +('Rocket Lab Mahia Observatory', 9, 15, NULL, 'Active'), +('Kodiak Observatory', 1, 16, NULL, 'Active'), +('JAXA Uchinoura Observatory', 5, 17, NULL, 'Active'), +('Palmachim Observatory', 1, 18, NULL, 'Active'), +('Xichang Observatory', 4, 19, NULL, 'Active'), +('Alcantara Observatory', 1, 20, NULL, 'Active'); + +-- =========================================== +-- 5) TELESCOPE (references observatory.id) +-- Must respect chk_telescope_mirror constraint +-- =========================================== +INSERT INTO telescope (observatory_id, name, telescope_type, mirror_diameter_m, status) +VALUES +(1, 'KPNO 2.1m Reflector', 'Optical', 2.1, 'Operational'), +(2, 'VLT UT1', 'Optical', 8.2, 'Operational'), +(3, 'La Silla 3.6m', 'Optical', 3.6, 'Operational'), +(4, 'VLA Antenna 1', 'Radio', NULL, 'Operational'), +(4, 'VLA Antenna 2', 'Radio', NULL, 'Operational'), +(5, 'Mt. Wilson Hooker', 'Optical', 2.5, 'Damaged'), +(6, 'Guiana Tracking Scope', 'Optical', 1.0, 'Operational'), +(7, 'Baikonur Radio Scope', 'Radio', NULL, 'Operational'), +(8, 'Jiuquan Infrared Telescope', 'Infrared', 1.2, 'Operational'), +(9, 'Satish Radio Array', 'Radio', NULL, 'Operational'), +(10, 'Tanegashima X-Ray Telescope', 'X-Ray', 1.5, 'Operational'), +(11, 'Vandenberg Surveillance Scope', 'Optical', 0.8, 'Operational'), +(12, 'Wenchang UV Scope', 'UV', 2.0, 'Operational'), +(13, 'Kennedy Multi-Purpose Scope', 'Other', NULL, 'Operational'), +(14, 'Blue Origin Radio Net', 'Radio', NULL, 'Operational'), +(15, 'Rocket Lab Tracking Scope', 'Optical', 0.5, 'Damaged'), +(16, 'Kodiak Optical', 'Optical', 0.9, 'Operational'), +(17, 'Uchinoura Space Monitor', 'Optical', 1.6, 'Operational'), +(18, 'Palmachim Optical', 'Optical', 2.0, 'Operational'), +(19, 'Xichang Radio Array', 'Radio', NULL, 'Operational'), +(20, 'Alcantara Optical', 'Optical', 1.5, 'Operational'); + +-- ==================================== +-- 6) SPACECRAFT (references agency.id) +-- ==================================== +INSERT INTO spacecraft (name, type, capacity, status, agency_id, last_mission_id) +VALUES +('Crew Dragon','Crewed',4,'Operational',7,NULL), +('Starliner','Crewed',4,'Operational',7,NULL), +('Soyuz MS','Crewed',3,'Operational',3,NULL), +('Shenzhou','Crewed',3,'Operational',4,NULL), +('Orion','Crewed',4,'Operational',1,NULL), +('Hubble Space Telescope','Orbiter',0,'Operational',1,NULL), +('Voyager 1','Probe',0,'Retired',1,NULL), +('Voyager 2','Probe',0,'Retired',1,NULL), +('Perseverance Rover','Rover',0,'Operational',1,NULL), +('Apollo CSM','Crewed',3,'Retired',1,NULL), +('Tiangong Station','Station',6,'Operational',4,NULL), +('ISS Module','Station',6,'Operational',1,NULL), +('BFS Starship','Crewed',100,'In Mission',7,NULL), +('Blue Moon Lander','Lander',0,'Operational',8,NULL), +('New Shepard','Crewed',6,'Operational',8,NULL), +('Electron Photon','Orbiter',0,'Operational',9,NULL), +('Falcon Heavy Upper Stage','Orbiter',0,'Operational',7,NULL), +('PSLV Orbiter','Orbiter',0,'Operational',6,NULL), +('Ariane Transfer Vehicle','Orbiter',0,'Operational',10,NULL), +('X-37B','Crewed',2,'Operational',1,NULL); + +-- ======================================================= +-- 7) ASTRONAUT (references agency.id, first_mission_id later) +-- We'll set first_mission_id = NULL initially +-- ======================================================= +INSERT INTO astronaut (first_name, last_name, birth_date, nationality, status, agency_id, first_mission_id) +VALUES +('Neil','Armstrong','1930-08-05','American','Deceased',1,NULL), +('Buzz','Aldrin','1930-01-20','American','Retired',1,NULL), +('Yuri','Gagarin','1934-03-09','Russian','Deceased',3,NULL), +('Valentina','Tereshkova','1937-03-06','Russian','Retired',3,NULL), +('Sally','Ride','1951-05-26','American','Deceased',1,NULL), +('Chris','Hadfield','1959-08-29','Canadian','Retired',11,NULL), +('Samantha','Cristoforetti','1977-04-26','Italian','Active',15,NULL), +('Yang','Liwei','1965-06-21','Chinese','Active',4,NULL), +('Sunita','Williams','1965-09-19','American','Active',1,NULL), +('Tim','Peake','1972-04-07','British','Active',13,NULL), +('Alexander','Ger-st','1976-05-03','German','Active',12,NULL), +('Peggy','Whitson','1960-02-09','American','Retired',1,NULL), +('Kate','Rubins','1978-10-14','American','Active',1,NULL), +('Akihiko','Hoshide','1968-12-28','Japanese','Active',5,NULL), +('Rakesh','Sharma','1949-01-13','Indian','Retired',6,NULL), +('Mae','Jemison','1956-10-17','American','Retired',1,NULL), +('Luca','Parmitano','1976-09-27','Italian','Active',15,NULL), +('Mark','Kelly','1964-02-21','American','Active',1,NULL), +('Oleg','Kononenko','1964-06-21','Russian','Active',3,NULL), +('Jessica','Meir','1977-07-01','American','Active',1,NULL); + +-- ============================================================= +-- 8) MISSION +-- References: spacecraft_id, destination_id, launch_site_id, +-- primary_agency_id, commander_id (only if manned) +-- We'll create 20. Some manned (commander_id NOT NULL), some unmanned. +-- ============================================================= +INSERT INTO mission +(name, mission_code, mission_type, status, launch_date, return_date, + spacecraft_id, destination_id, launch_site_id, primary_agency_id, commander_id) +VALUES +('Apollo 11','M-001','Manned','Completed','1969-07-16','1969-07-24',10,4,1,1,1), +('Soyuz TMA-1','M-002','Manned','Completed','2002-10-30','2003-05-04',3,4,5,3,4), +('Shenzhou 5','M-003','Manned','Completed','2003-10-15','2003-10-16',4,4,9,4,8), +('ISS Expedition 50','M-004','Manned','Completed','2016-10-17','2017-04-10',12,4,3,1,11), +('Crew-1','M-005','Manned','Completed','2020-11-16','2021-05-02',1,4,1,1,9), +('Crew-2','M-006','Manned','Completed','2021-04-23','2021-11-08',1,4,13,1,18), +('Gaganyaan Demo','M-007','Manned','Planned','2025-01-01',NULL,18,4,10,6,15), +('JAXA Hoshide Flight','M-008','Manned','Active','2023-06-10',NULL,5,4,11,5,14), +('ESA Cristoforetti Flight','M-009','Manned','Active','2022-04-01',NULL,2,4,3,2,7), +('Roscosmos Kononenko Flight','M-010','Manned','Planned','2024-10-10',NULL,3,4,6,3,19), +('Voyager 1 Launch','M-011','Unmanned','Completed','1977-09-05','1977-09-05',7,1,1,1,NULL), +('Voyager 2 Launch','M-012','Unmanned','Completed','1977-08-20','1977-08-20',8,1,1,1,NULL), +('Perseverance to Mars','M-013','Unmanned','Active','2020-07-30',NULL,9,5,1,1,NULL), +('Chang\'e 4','M-014','Unmanned','Completed','2018-12-08','2019-01-03',4,11,9,4,NULL), +('Tianwen-1','M-015','Unmanned','Active','2020-07-23',NULL,4,5,9,4,NULL), +('Mangalyaan','M-016','Unmanned','Completed','2013-11-05','2014-09-24',18,5,10,6,NULL), +('New Shepard Test','M-017','Unmanned','Completed','2019-01-23','2019-01-23',15,1,14,8,NULL), +('Electron Demo','M-018','Unmanned','Completed','2017-05-25','2017-05-25',16,1,15,9,NULL), +('Ariane Transfer Test','M-019','Unmanned','Completed','2019-10-01','2019-10-01',19,1,7,10,NULL), +('X-37B OTV-6','M-020','Unmanned','Active','2020-05-17',NULL,20,1,3,1,NULL); + +-- ================================================================= +-- 9) MISSION_CREW (references mission.id and astronaut.id) +-- We only assign crew to MANNED missions (IDs 1..10 of mission). +-- We'll insert exactly 20 rows: 2 for each manned mission. +-- ================================================================= +INSERT INTO mission_crew (mission_id, astronaut_id, role) +VALUES +-- Apollo 11 +(1, 1, 'Commander'), +(1, 2, 'Pilot'), +-- Soyuz TMA-1 +(2, 4, 'Commander'), +(2, 19, 'Engineer'), +-- Shenzhou 5 +(3, 8, 'Commander'), +(3, 7, 'Scientist'), +-- ISS Expedition 50 +(4, 11, 'Commander'), +(4, 20, 'Engineer'), +-- Crew-1 +(5, 9, 'Commander'), +(5, 13, 'Engineer'), +-- Crew-2 +(6, 18, 'Commander'), +(6, 10, 'Scientist'), +-- Gaganyaan Demo +(7, 15, 'Commander'), +(7, 5, 'Scientist'), +-- JAXA Hoshide Flight +(8, 14, 'Commander'), +(8, 6, 'Engineer'), +-- ESA Cristoforetti Flight +(9, 7, 'Commander'), +(9, 16, 'Engineer'), +-- Roscosmos Kononenko Flight +(10, 19, 'Commander'), +(10, 3, 'Specialist'); + +-- ===================================== +-- 10) MISSION_LOG (references mission.id) +-- 20 log entries +-- ===================================== +INSERT INTO mission_log (mission_id, log_time, event) +VALUES +(1, '2006-07-16 13:32:00', 'Launch from Kennedy LC-39A'), +(1, '2006-07-19 18:00:00', 'Lunar orbit insertion'), +(1, '2016-07-21 02:56:00', 'First step on Moon'), +(2, '2002-10-30 06:00:00', 'Launch successful'), +(2, '2003-05-04 02:00:00', 'Landing in Kazakhstan'), +(3, '2003-10-15 09:00:00', 'Launch from Jiuquan'), +(4, '2016-10-17 10:00:00', 'Expedition 50 started'), +(4, '2017-04-10 21:00:00', 'Expedition 50 ended'), +(5, '2020-11-16 19:27:00', 'Crew-1 Liftoff'), +(5, '2021-05-02 06:35:00', 'Crew-1 Splashdown'), +(6, '2021-04-23 09:49:00', 'Crew-2 Launch'), +(7, '2025-01-01 05:00:00', 'Gaganyaan Demo scheduled'), +(8, '2023-06-10 07:15:00', 'JAXA Hoshide Flight launched'), +(9, '2022-04-01 08:00:00', 'ESA Cristoforetti Flight begun'), +(10, '2024-10-10 06:00:00', 'Roscosmos Kononenko flight scheduled'), +(11, '2016-09-05 14:56:00', 'Voyager 1 Launch'), +(12, '2016-08-20 12:29:00', 'Voyager 2 Launch'), +(13, '2020-07-30 11:50:00', 'Perseverance launched to Mars'), +(14, '2018-12-08 18:23:00', 'Chang\'e 4 launched'), +(15, '2020-07-23 12:41:00', 'Tianwen-1 launched'); + +-- ============================================================= +-- 11) RESEARCH_PROJECT (references lead_astronaut_id) +-- 20 distinct projects +-- ============================================================= +INSERT INTO research_project (title, description, start_date, end_date, lead_astronaut_id) +VALUES +('Lunar Soil Analysis','Study of lunar regolith samples','2021-01-01','2021-12-31',2), +('Mars Rover Experiments','Analyze data from Perseverance','2021-02-15','2022-06-30',9), +('ISS Plant Growth','Growing plants in microgravity','2019-05-01','2020-08-15',11), +('Solar Flare Observations','Tracking solar flare activity','2020-01-01',NULL,7), +('Space Medicine Trial','Effects of microgravity on bone density','2022-01-01',NULL,10), +('Lunar Water Mapping','Remote sensing for lunar water','2023-03-01',NULL,7), +('Asteroid Mining Feasibility','Mining operations in near-earth asteroids','2024-01-10',NULL,8), +('Exoplanet Atmosphere Study','Spectroscopic analysis of exoplanets','2020-06-01','2022-06-01',14), +('Radiation Shielding Tests','Testing new materials for cosmic rays','2021-09-01','2023-03-01',16), +('Deep Space Habitats','Designing habitats for long-duration missions','2021-11-01',NULL,18), +('Cislunar Navigation Systems','Testing navigation near the Moon','2022-04-10','2022-12-31',4), +('Space Debris Tracking','Tracking and cataloging orbital debris','2021-10-01',NULL,20), +('MOXIE Enhancement','Improving oxygen production on Mars','2023-07-01',NULL,15), +('Europa Subsurface Probe','Concept for exploring Europa','2025-01-01',NULL,19), +('Multinational Lunar Station','Designing an international lunar outpost','2023-05-05',NULL,7), +('Microbe Studies in Orbit','Microorganisms behavior in LEO','2024-02-02','2024-12-31',9), +('High-Definition Earth Imaging','Advanced imaging from ISS','2022-08-15','2023-09-10',5), +('Plasma Physics in Microgravity','Plasma experiments in orbit','2021-01-10','2022-01-10',8), +('Asteroid Redirect Mission','Test mission for redirecting asteroids','2023-09-01',NULL,3), +('Lunar Gateway Tech Demo','Tech demos for Gateway station','2022-01-05',NULL,1); + +-- ================================================================== +-- 12) PROJECT_MISSION (references research_project.id, mission.id) +-- 20 combos (no duplicates) +-- ================================================================== +INSERT INTO project_mission (project_id, mission_id) +VALUES +(1, 1), +(2, 13), +(3, 4), +(4, 11), +(5, 5), +(6, 1), +(7, 16), +(8, 18), +(9, 4), +(10, 6), +(11, 14), +(12, 20), +(13, 13), +(14, 9), +(15, 1), +(16, 5), +(17, 4), +(18, 8), +(19, 12), +(20, 2); + +-- ============================================================== +-- 13) INSTRUMENT (references telescope_id, spacecraft_id) +-- 20 instruments, some on telescopes, some on spacecraft +-- ============================================================== +INSERT INTO instrument (name, instrument_type, telescope_id, spacecraft_id, status) +VALUES +('Wide Field Camera','Camera',1,NULL,'In Use'), +('Spectro Analyzer','Spectrometer',2,NULL,'Available'), +('Thermal Sensor','Sensor',3,NULL,'Damaged'), +('Deep Space Cam','Camera',4,NULL,'Available'), +('UV Spectrometer','Spectrometer',5,NULL,'Available'), +('InfraRed Mapper','Camera',9,NULL,'Available'), +('X-Ray Detector','Sensor',10,NULL,'Available'), +('Orbit Docking Module','Module',NULL,10,'In Use'), +('High-Gain Antenna','Sensor',NULL,7,'Available'), +('Mars Drill','Other',NULL,9,'In Use'), +('CO2 Scrubber','Module',NULL,5,'Available'), +('Lunar Lander Cam','Camera',NULL,14,'Available'), +('Starship Life Support','Module',NULL,13,'In Use'), +('ISS Research Module','Module',NULL,12,'In Use'), +('Soyuz Docking Adapter','Other',NULL,3,'Available'), +('Crew Dragon Display','Other',NULL,1,'Available'), +('Probe Thermal Shield','Module',NULL,8,'Retired'), +('Rover Soil Sensor','Sensor',NULL,9,'In Use'), +('Radio Frequency Sensor','Sensor',19,NULL,'Available'), +('Navigation Beacon','Other',NULL,19,'Available'); + +-- ================================================================== +-- 14) OBSERVATION_SESSION (refs telescope_id, instrument_id, +-- target_body_id, mission_id) +-- 20 sessions. Avoid referencing 'Retired' telescopes or +-- obviously invalid combos. +-- ================================================================== +INSERT INTO observation_session +(telescope_id, instrument_id, target_body_id, mission_id, start_time, end_time, seeing_conditions, notes) +VALUES +(1, 1, 1, NULL, '2021-01-01 03:00:00','2021-01-01 06:00:00','Excellent','Solar observation at dawn'), +(2, 2, 3, NULL, '2022-02-10 20:00:00','2022-02-11 02:00:00','Good','Venus spectroscopy'), +(3, 3, 2, NULL, '2022-03-15 22:00:00','2022-03-16 01:00:00','Fair','Mercury thermal scan'), +(4, 4, 1, NULL, '2023-01-05 18:00:00','2023-01-05 20:00:00','Good','Radio check of sun activity'), +(9, 6, 5, 13, '2021-08-01 10:00:00','2021-08-01 12:00:00','Excellent','Mars mapping from orbit'), +(10, 7, 11, 14, '2019-01-03 00:00:00','2019-01-03 02:00:00','Poor','Chang\'e 4 lunar landing observation'), +(11, 1, 4, 2, '2002-10-30 07:00:00','2002-10-30 08:30:00','Good','Earth coverage during Soyuz TMA-1'), +(12, 2, 4, 6, '2021-04-23 10:00:00','2021-04-23 11:00:00','Good','Crew-2 Earth observation'), +(14, 5, 1, 17, '2019-01-23 10:15:00','2019-01-23 10:45:00','Excellent','New Shepard test flight tracking'), +(16, 1, 1, NULL, '2022-07-10 22:00:00','2022-07-10 23:00:00','Fair','Night sky solar calibration?'), +(17, 2, 4, 8, '2023-06-10 08:30:00','2023-06-10 09:30:00','Good','Hoshide flight Earth imaging'), +(18, 4, 1, 9, '2022-04-01 10:00:00','2022-04-01 10:30:00','Excellent','Cristoforetti flight solar check'), +(19, 19, 1, NULL, '2023-01-15 06:00:00','2023-01-15 08:00:00','Good','Radio array scanning sun'), +(20, NULL, 4, NULL, '2023-04-20 12:00:00','2023-04-20 13:00:00','Fair','Earth imaging test'), +(2, NULL, 9, NULL, '2023-05-10 22:00:00','2023-05-10 23:00:00','Poor','Neptune test pointing'), +(5, NULL, 4, NULL, '2022-06-11 09:00:00','2022-06-11 09:15:00','Good','Quick Earth check'), +(9, 10, 5, 16, '2013-11-05 05:10:00','2013-11-05 06:00:00','Excellent','Mangalyaan launch tracking'), +(3, 2, 19, NULL, '2023-06-01 19:00:00','2023-06-01 19:30:00','Good','Halley Comet radio check'), +(10, 7, 11, NULL, '2020-12-01 02:00:00','2020-12-01 03:00:00','Fair','Moon x-ray imaging test'), +(11, 1, 4, 5, '2020-11-16 20:00:00','2020-11-16 21:00:00','Good','Crew-1 Earth observation'); + +-- ============================================================== +-- 15) DATA_SET (references mission_id, observation_id) +-- 20 data sets +-- ============================================================== +INSERT INTO data_set +(name, mission_id, observation_id, data_description, data_blob, collected_on) +VALUES +('Apollo 11 EVA Photos', 1, NULL, 'Images captured during lunar EVA', NULL, '1969-07-21'), +('Soyuz TMA-1 Reentry Data', 2, 7, 'Telemetry from reentry phase', NULL, '2003-05-04'), +('Shenzhou 5 Launch Telemetry', 3, NULL, 'Launch-phase telemetry logs', NULL, '2003-10-16'), +('VLA Sun Scan 2023', NULL, 4, 'Radio observations of sun activity', NULL, '2023-01-05'), +('Perseverance Mars Images', 13, 5, 'High-res color images of Mars surface', NULL, '2021-08-01'), +('Chang\'e 4 Landing Data', 14, 6, 'Lunar far side landing data', NULL, '2019-01-03'), +('Crew-1 Earth Photos', 5, 20, 'Photos of Earth during Crew-1 mission', NULL, '2020-11-16'), +('Crew-2 Solar Observations', 6, 12, 'Sun observations from orbit', NULL, '2021-04-23'), +('New Shepard Flight Test Data', 17, 9, 'Flight telemetry of suborbital test', NULL, '2019-01-23'), +('Neptune Spectral Data', NULL, 15, 'Spectral lines measurement at Neptune', NULL, '2023-05-10'), +('Mars Launch Tracking', 16, 17, 'Launch tracking data for Mangalyaan', NULL, '2013-11-05'), +('Halley Comet Radio Observations', NULL, 18, 'Comet radio signature logs', NULL, '2023-06-01'), +('Moon X-Ray Test', NULL, 19, 'Preliminary x-ray imaging of moon', NULL, '2020-12-01'), +('Gaganyaan Preliminary Data', 7, NULL, 'Planned data sets for Gaganyaan Demo', NULL, '2025-01-01'), +('Apollo 11 Sample Analysis', 1, NULL, 'Follow-up on lunar rock composition', NULL, '1969-08-01'), +('Crew-2 Docking Logs', 6, NULL, 'Data logs from ISS docking operations', NULL, '2021-04-24'), +('Voyager 1 Launch Video', 11, NULL, 'Historic launch footage', NULL, '1977-09-05'), +('Voyager 2 Launch Telemetry', 12, NULL, 'Launch data logs', NULL, '1977-08-20'), +('X-37B Flight Data', 20, NULL, 'OTV-6 in-orbit experiment logs', NULL, '2020-05-17'), +('ISS Exp 50 Plant Growth Logs', 4, 8, 'Plant growth experiment data on ISS', NULL, '2016-10-18'); + +-- ================================================================== +-- 16) RESEARCH_PAPER (references project_id, observatory_id) +-- 20 papers +-- ================================================================== +INSERT INTO research_paper +(title, abstract, published_date, doi, project_id, observatory_id) +VALUES +('Lunar Soil Composition','Study of Apollo 11 soil samples','1970-01-10','10.1234/lunar.1970',1,1), +('Mars Rover Camera Analysis','Review of Perseverance imaging tech','2021-12-01','10.1234/mars.2021',2,2), +('ISS Plant Growth Results','Plant experiments in microgravity','2020-01-15','10.1234/iss.2020',3,4), +('Solar Flare Impact','Observations of solar flare activity','2020-08-01','10.1234/sol.2020',4,1), +('Space Medicine Advances','Bone density and microgravity','2022-03-01','10.1234/med.2022',5,4), +('Lunar Water Prospecting','Findings on remote sensing of lunar water','2024-01-01','10.1234/lunwat.2024',6,2), +('Asteroid Mining Potential','Tech feasibility of asteroid resources','2025-04-10','10.1234/astmine.2025',7,3), +('Exoplanet Atmospheres','Spectroscopic approaches','2021-07-01','10.1234/exo.2021',8,3), +('Radiation Shield Test','Lab results for cosmic ray shielding','2023-04-15','10.1234/rad.2023',9,4), +('Deep Space Habitat Concepts','Architectures for long missions','2022-11-20','10.1234/dsh.2022',10,5), +('Cislunar Nav & Guidance','Methods for lunar orbit nav','2023-02-10','10.1234/nav.2023',11,6), +('Space Debris Mitigation','Tech to reduce orbital debris','2021-11-11','10.1234/debris.2021',12,7), +('Mars Oxygen ISRU','Enhancements to MOXIE','2024-06-22','10.1234/moxie.2024',13,8), +('Europa Probe Design','Conceptual design for subsurface probe','2025-02-01','10.1234/europa.2025',14,9), +('Lunar Station Architecture','Plans for multinational station','2023-07-07','10.1234/lunast.2023',15,10), +('Microbes in Orbit','Results from microorganisms in LEO','2025-06-15','10.1234/microbe.2025',16,11), +('HD Earth Imaging','Tech used for ISS imaging','2023-02-28','10.1234/hdearth.2023',17,12), +('Plasma Experiments','Plasma behavior in microgravity','2022-05-05','10.1234/plasma.2022',18,13), +('Asteroid Redirect Feasibility','Examining methods to deflect asteroids','2024-01-20','10.1234/arm.2024',19,14), +('Lunar Gateway Tech Preview','Early results from gateway prototypes','2023-03-01','10.1234/gateway.2023',20,15); + +-- ===================================================================== +-- 17) PAPER_CITATION (references research_paper.id) +-- 20 citations, no self-citations, no duplicates +-- ===================================================================== +INSERT INTO paper_citation (citing_paper_id, cited_paper_id, citation_date) +VALUES +(2,1,'2021-12-10'), +(3,1,'2020-01-20'), +(4,1,'2020-08-10'), +(5,1,'2022-03-05'), +(5,2,'2022-03-06'), +(6,4,'2024-01-02'), +(7,4,'2025-04-15'), +(8,2,'2021-07-10'), +(9,2,'2023-04-20'), +(10,3,'2022-11-30'), +(11,1,'2023-02-15'), +(12,9,'2021-11-12'), +(13,2,'2024-07-01'), +(14,4,'2025-02-10'), +(15,6,'2023-07-08'), +(16,3,'2025-06-20'), +(17,3,'2023-03-01'), +(18,9,'2022-05-10'), +(19,7,'2024-01-25'), +(20,1,'2023-03-05'); + +-- ============================================ +-- 18) GRANT (references agency.id) +-- 20 grants +-- ============================================ +INSERT INTO `grant` (grant_number, agency_id, funding_amount, start_date, end_date, status) +VALUES +('GRANT-001', 1, 1000000.00, '2020-01-01','2020-12-31','Closed'), +('GRANT-002', 2, 2000000.00, '2021-01-01','2022-01-01','Closed'), +('GRANT-003', 3, 500000.00, '2022-01-01','2023-01-01','Closed'), +('GRANT-004', 4, 2500000.00, '2023-01-01',NULL,'Active'), +('GRANT-005', 5, 750000.00, '2021-06-01','2022-06-01','Closed'), +('GRANT-006', 6, 300000.00, '2022-05-01','2023-04-30','Closed'), +('GRANT-007', 7, 15000000.00, '2023-01-01','2025-12-31','Active'), +('GRANT-008', 8, 5000000.00, '2022-11-01','2024-11-01','Active'), +('GRANT-009', 9, 10000000.00, '2020-02-01',NULL,'Awarded'), +('GRANT-010', 10, 20000000.00, '2019-01-01',NULL,'Canceled'), +('GRANT-011', 11, 400000.00, '2021-04-01','2023-04-01','Closed'), +('GRANT-012', 12, 1000000.00, '2022-02-10',NULL,'Active'), +('GRANT-013', 13, 500000.00, '2023-03-10',NULL,'Proposed'), +('GRANT-014', 14, 7500000.00, '2022-07-01','2023-07-01','Closed'), +('GRANT-015', 15, 250000.00, '2023-01-10','2023-12-31','Active'), +('GRANT-016', 16, 125000.00, '2021-01-05','2022-01-05','Closed'), +('GRANT-017', 17, 100000000.00, '2024-01-01','2029-12-31','Proposed'), +('GRANT-018', 18, 2000000.00, '2023-06-01',NULL,'Active'), +('GRANT-019', 19, 300000.00, '2022-01-20','2022-12-20','Closed'), +('GRANT-020', 20, 999999.99, '2024-02-02',NULL,'Proposed'); + +-- ====================================================================== +-- 19) GRANT_RESEARCH_PROJECT (references grant.id, research_project.id) +-- 20 combos +-- ====================================================================== +INSERT INTO grant_research_project (grant_id, research_project_id, allocated_amount) +VALUES +(1,1,100000.00), +(2,2,1500000.00), +(3,3,300000.00), +(4,4,2000000.00), +(5,5,500000.00), +(6,6,250000.00), +(7,7,10000000.00), +(8,8,4500000.00), +(9,9,9000000.00), +(10,10,18000000.00), +(11,11,200000.00), +(12,12,900000.00), +(13,13,400000.00), +(14,14,7000000.00), +(15,15,100000.00), +(16,16,100000.00), +(17,17,50000000.00), +(18,18,1500000.00), +(19,19,200000.00), +(20,20,500000.00); + +-- ====================================================================== +-- 20) INSTRUMENT_USAGE (references instrument.id, telescope.id, spacecraft.id) +-- 20 usage entries +-- ====================================================================== +INSERT INTO instrument_usage +(instrument_id, telescope_id, spacecraft_id, start_date, end_date, usage_notes) +VALUES +(1, 1, NULL, '2021-01-01','2021-02-01','Camera used on KPNO telescope'), +(2, 2, NULL, '2021-06-01','2021-06-10','Spectrometer trial on VLT UT1'), +(3, 3, NULL, '2022-03-15','2022-03-20','Thermal sensor test at La Silla'), +(4, 4, NULL, '2023-01-05',NULL,'Deep Space Cam on VLA Antenna 1'), +(5, 5, NULL, '2023-06-10',NULL,'UV spectroscopy test at Mt. Wilson'), +(6, 9, NULL, '2021-08-01','2021-08-02','IR Mapper for Mars observation'), +(7, 10, NULL, '2019-01-03','2019-01-04','X-Ray detection from Chang\'e 4 vantage'), +(8, NULL, 10, '2021-05-01','2021-05-15','Docking module installed on Apollo CSM'), +(9, NULL, 7, '1977-09-05','1977-09-10','High-Gain Antenna for Voyager 1'), +(10, NULL, 9, '2020-07-30','2020-08-15','Mars Drill for Perseverance'), +(11, NULL, 5, '2023-06-10','2023-06-20','CO2 Scrubber test on Orion'), +(12, NULL, 14, '2020-12-01','2020-12-10','Lunar Lander Cam test on Blue Moon'), +(13, NULL, 13, '2023-02-01','2023-03-01','Life support system usage on Starship'), +(14, NULL, 12, '2016-10-17','2017-04-10','ISS research module usage in Exp 50'), +(15, NULL, 3, '2002-10-30','2002-10-31','Soyuz docking adapter test'), +(16, NULL, 1, '2020-11-16','2020-11-20','Crew Dragon display test'), +(17, NULL, 8, '1977-08-20','1977-08-28','Probe thermal shield on Voyager 2'), +(18, NULL, 9, '2021-08-01','2021-09-01','Soil sensor on Perseverance'), +(19, 19, NULL, '2023-01-15','2023-01-16','Radio frequency sensor on Xichang array'), +(20, NULL, 19, '2019-10-01','2019-10-02','Navigation beacon on Ariane Transfer Vehicle'); + + +UPDATE astronaut SET first_mission_id = 1 WHERE id IN (1, 2); -- Armstrong, Aldrin +UPDATE astronaut SET first_mission_id = 2 WHERE id IN (4, 19); -- Tereshkova, Kononenko +UPDATE astronaut SET first_mission_id = 3 WHERE id IN (7, 8); -- Cristoforetti, Yang +UPDATE astronaut SET first_mission_id = 4 WHERE id IN (11, 20); -- Gerst, Meir +UPDATE astronaut SET first_mission_id = 5 WHERE id IN (9, 13); -- Williams, Rubins +UPDATE astronaut SET first_mission_id = 6 WHERE id IN (10, 18); -- Peake, Mark Kelly +UPDATE astronaut SET first_mission_id = 7 WHERE id IN (5, 15); -- Ride, Rakesh +UPDATE astronaut SET first_mission_id = 8 WHERE id IN (6, 14); -- Hadfield, A. Hoshide +UPDATE astronaut SET first_mission_id = 9 WHERE id = 16; -- Mae Jemison +UPDATE astronaut SET first_mission_id = 10 WHERE id = 3; -- Yuri Gagarin +SET FOREIGN_KEY_CHECKS=1; + diff --git a/internal/testutil/testdata/mysql/complex/job-mappings.go b/internal/testutil/testdata/mysql/complex/job-mappings.go index a5aaa79426..ca4f2651a1 100644 --- a/internal/testutil/testdata/mysql/complex/job-mappings.go +++ b/internal/testutil/testdata/mysql/complex/job-mappings.go @@ -2077,6 +2077,97 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { }, }, }, + { + Schema: schema, + Table: "grant", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant", + Column: "grant_number", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant", + Column: "agency_id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant", + Column: "funding_amount", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant", + Column: "start_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant", + Column: "end_date", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, + { + Schema: schema, + Table: "grant", + Column: "status", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Config: + &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + }, + }, } } From 9035410d6cff3f501bf6e180d2cc6d4d3c16a0d4 Mon Sep 17 00:00:00 2001 From: Alisha Date: Mon, 10 Mar 2025 17:21:58 -0700 Subject: [PATCH 4/5] remove commented out code --- backend/pkg/sqlmanager/mysql/mysql-manager.go | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/backend/pkg/sqlmanager/mysql/mysql-manager.go b/backend/pkg/sqlmanager/mysql/mysql-manager.go index beab17e881..32ceed0aca 100644 --- a/backend/pkg/sqlmanager/mysql/mysql-manager.go +++ b/backend/pkg/sqlmanager/mysql/mysql-manager.go @@ -357,43 +357,6 @@ func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*sql }) } - // indexmap := map[string]map[string][]string{} - // var indexMapMu sync.Mutex - // for schema, tables := range schemaset { - // errgrp.Go(func() error { - // idxrecords, err := m.querier.GetIndicesBySchemasAndTables(errctx, m.pool, &mysql_queries.GetIndicesBySchemasAndTablesParams{ - // Schema: schema, - // Tables: tables, - // }) - // if err != nil { - // return fmt.Errorf("failed to build mysql indices by schemas and tables: %w", err) - // } - - // indexMapMu.Lock() - // defer indexMapMu.Unlock() - // for _, record := range idxrecords { - // key := sqlmanager_shared.SchemaTable{Schema: record.SchemaName, Table: record.TableName} - // if _, exists := indexmap[key.String()]; !exists { - // indexmap[key.String()] = make(map[string][]string) - // } - // // Group columns/expressions by index name - // if record.ColumnName.Valid { - // indexmap[key.String()][record.IndexName] = append( - // indexmap[key.String()][record.IndexName], - // record.ColumnName.String, - // ) - // } else if record.Expression.Valid { - // indexmap[key.String()][record.IndexName] = append( - // indexmap[key.String()][record.IndexName], - // // expressions must be wrapped in parentheses on creation, but don't come out of the DB in that format /shrug - // fmt.Sprintf("(%s)", record.Expression.String), - // ) - // } - // } - // return nil - // }) - // } - indexmap := map[string]map[string]*indexInfo{} var indexMapMu sync.Mutex for schema, tables := range schemaset { From c48376411844f8133f590c3d7e6491ceea0fc172 Mon Sep 17 00:00:00 2001 From: Alisha Date: Tue, 11 Mar 2025 10:27:57 -0700 Subject: [PATCH 5/5] clean up --- backend/pkg/sqlmanager/mysql/mysql-manager.go | 7 +- .../testdata/gen_jobmappings_config.json | 5 - .../testdata/mysql/complex/job-mappings.go | 1503 ++++++++--------- 3 files changed, 669 insertions(+), 846 deletions(-) diff --git a/backend/pkg/sqlmanager/mysql/mysql-manager.go b/backend/pkg/sqlmanager/mysql/mysql-manager.go index 32ceed0aca..b203b2359a 100644 --- a/backend/pkg/sqlmanager/mysql/mysql-manager.go +++ b/backend/pkg/sqlmanager/mysql/mysql-manager.go @@ -374,12 +374,11 @@ func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*sql for _, record := range idxrecords { key := sqlmanager_shared.SchemaTable{Schema: record.SchemaName, Table: record.TableName} if _, exists := indexmap[key.String()]; !exists { - indexmap[key.String()] = make(map[string]*indexInfo) // Adjusted to map to *indexInfo + indexmap[key.String()] = make(map[string]*indexInfo) } - // Group columns/expressions by index name if record.ColumnName.Valid { if _, exists := indexmap[key.String()][record.IndexName]; !exists { - indexmap[key.String()][record.IndexName] = &indexInfo{ // Initialize indexInfo + indexmap[key.String()][record.IndexName] = &indexInfo{ indexName: record.IndexName, indexType: record.IndexType, columns: []string{}, @@ -391,7 +390,7 @@ func (m *MysqlManager) GetTableInitStatements(ctx context.Context, tables []*sql ) } else if record.Expression.Valid { if _, exists := indexmap[key.String()][record.IndexName]; !exists { - indexmap[key.String()][record.IndexName] = &indexInfo{ // Initialize indexInfo + indexmap[key.String()][record.IndexName] = &indexInfo{ indexName: record.IndexName, indexType: record.IndexType, columns: []string{}, diff --git a/internal/testutil/testdata/gen_jobmappings_config.json b/internal/testutil/testdata/gen_jobmappings_config.json index 26b11c3a78..1890c38160 100644 --- a/internal/testutil/testdata/gen_jobmappings_config.json +++ b/internal/testutil/testdata/gen_jobmappings_config.json @@ -54,11 +54,6 @@ "sql_file": "create-tables.sql", "driver": "mysql" }, - { - "folder": "mysql/complex", - "sql_file": "create-tables.sql", - "driver": "mysql" - }, { "folder": "mssql/alltypes", "sql_file": "create-tables.sql", diff --git a/internal/testutil/testdata/mysql/complex/job-mappings.go b/internal/testutil/testdata/mysql/complex/job-mappings.go index ca4f2651a1..090f3f8fae 100644 --- a/internal/testutil/testdata/mysql/complex/job-mappings.go +++ b/internal/testutil/testdata/mysql/complex/job-mappings.go @@ -1,26 +1,21 @@ - -// Code generated by Neosync jobmapping_generator. DO NOT EDIT. -// source: create-tables.sql - package mysql_complex import ( mgmtv1alpha1 "github.com/nucleuscloud/neosync/backend/gen/go/protos/mgmt/v1alpha1" ) -func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { - return []*mgmtv1alpha1.JobMapping{ +func GetDefaultSyncJobMappings(schema string) []*mgmtv1alpha1.JobMapping { + return []*mgmtv1alpha1.JobMapping{ { Schema: schema, Table: "agency", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -28,12 +23,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "agency", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -41,12 +35,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "agency", Column: "country", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -54,12 +47,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "agency", Column: "founded_year", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -67,12 +59,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "agency", Column: "INDEX", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -80,12 +71,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -93,12 +83,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "first_name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -106,12 +95,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "last_name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -119,12 +107,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "birth_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -132,12 +119,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "nationality", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -145,12 +131,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "status", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -158,12 +143,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "agency_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -171,12 +155,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "first_mission_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -184,12 +167,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -197,12 +179,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -210,12 +191,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "astronaut", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -223,12 +203,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -236,12 +215,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -249,12 +227,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "body_type", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -262,12 +239,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "mass", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -275,12 +251,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "radius", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -288,12 +263,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "parent_body_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -301,12 +275,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -314,12 +287,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -327,12 +299,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "celestial_body", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -340,12 +311,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "data_set", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -353,12 +323,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "data_set", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -366,12 +335,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "data_set", Column: "mission_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -379,12 +347,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "data_set", Column: "observation_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -392,12 +359,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "data_set", Column: "data_description", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -405,12 +371,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "data_set", Column: "data_blob", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -418,12 +383,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "data_set", Column: "collected_on", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -431,12 +395,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant_research_project", Column: "grant_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -444,12 +407,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant_research_project", Column: "research_project_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -457,12 +419,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant_research_project", Column: "allocated_amount", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -470,12 +431,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -483,12 +443,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -496,12 +455,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument", Column: "instrument_type", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -509,12 +467,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument", Column: "telescope_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -522,12 +479,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument", Column: "spacecraft_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -535,12 +491,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument", Column: "status", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -548,12 +503,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument_usage", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -561,12 +515,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument_usage", Column: "instrument_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -574,12 +527,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument_usage", Column: "telescope_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -587,12 +539,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument_usage", Column: "spacecraft_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -600,12 +551,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument_usage", Column: "start_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -613,12 +563,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument_usage", Column: "end_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -626,12 +575,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "instrument_usage", Column: "usage_notes", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -639,12 +587,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "launch_site", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -652,12 +599,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "launch_site", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -665,12 +611,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "launch_site", Column: "location", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -678,12 +623,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "launch_site", Column: "location_coord", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -691,12 +635,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "launch_site", Column: "country", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -704,12 +647,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "launch_site", Column: "SPATIAL", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -717,12 +659,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -730,12 +671,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -743,12 +683,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "mission_code", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -756,12 +695,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "mission_type", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -769,12 +707,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "status", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -782,12 +719,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "launch_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -795,12 +731,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "return_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -808,12 +743,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "spacecraft_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -821,12 +755,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "destination_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -834,12 +767,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "launch_site_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -847,12 +779,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "primary_agency_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -860,12 +791,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "commander_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -873,12 +803,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -886,12 +815,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -899,12 +827,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -912,12 +839,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -925,12 +851,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -938,12 +863,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -951,12 +875,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -964,12 +887,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -977,12 +899,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -990,12 +911,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1003,12 +923,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1016,12 +935,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1029,12 +947,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1042,12 +959,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1055,12 +971,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1068,12 +983,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "mission_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1081,12 +995,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "astronaut_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1094,12 +1007,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "role", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1107,12 +1019,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1120,12 +1031,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1133,12 +1043,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1146,12 +1055,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1159,12 +1067,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1172,12 +1079,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1185,12 +1091,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_crew", Column: "INDEX", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1198,12 +1103,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_log", Column: "log_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1211,12 +1115,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_log", Column: "mission_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1224,12 +1127,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_log", Column: "log_time", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1237,12 +1139,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_log", Column: "event", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1250,12 +1151,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_log", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1263,12 +1163,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_log", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1276,12 +1175,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_log", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1289,12 +1187,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "mission_log", Column: "INDEX", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1302,12 +1199,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1315,12 +1211,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "telescope_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1328,12 +1223,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "instrument_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1341,12 +1235,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "target_body_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1354,12 +1247,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "mission_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1367,12 +1259,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "start_time", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1380,12 +1271,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "end_time", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1393,12 +1283,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "seeing_conditions", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1406,12 +1295,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observation_session", Column: "notes", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1419,12 +1307,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observatory", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1432,12 +1319,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observatory", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1445,12 +1331,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observatory", Column: "agency_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1458,12 +1343,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observatory", Column: "launch_site_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1471,12 +1355,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observatory", Column: "location_coord", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1484,12 +1367,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "observatory", Column: "status", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1497,12 +1379,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "paper_citation", Column: "citing_paper_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1510,12 +1391,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "paper_citation", Column: "cited_paper_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1523,12 +1403,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "paper_citation", Column: "citation_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1536,12 +1415,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "project_mission", Column: "project_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1549,12 +1427,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "project_mission", Column: "mission_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1562,12 +1439,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "project_mission", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1575,12 +1451,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "project_mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1588,12 +1463,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "project_mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1601,12 +1475,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "project_mission", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1614,12 +1487,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "project_mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1627,12 +1499,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "project_mission", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1640,12 +1511,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_paper", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1653,12 +1523,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_paper", Column: "title", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1666,12 +1535,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_paper", Column: "abstract", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1679,12 +1547,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_paper", Column: "published_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1692,12 +1559,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_paper", Column: "doi", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1705,12 +1571,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_paper", Column: "project_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1718,12 +1583,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_paper", Column: "observatory_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1731,12 +1595,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_paper", Column: "FULLTEXT", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1744,12 +1607,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1757,12 +1619,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "title", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1770,12 +1631,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "description", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1783,12 +1643,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "start_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1796,12 +1655,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "end_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1809,12 +1667,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "lead_astronaut_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1822,12 +1679,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1835,12 +1691,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1848,12 +1703,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1861,12 +1715,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "research_project", Column: "FULLTEXT", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1874,12 +1727,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1887,12 +1739,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1900,12 +1751,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "type", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1913,12 +1763,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "capacity", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1926,12 +1775,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "status", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1939,12 +1787,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "agency_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1952,12 +1799,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "last_mission_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1965,12 +1811,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "FOREIGN", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1978,12 +1823,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -1991,12 +1835,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "spacecraft", Column: "ON", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2004,12 +1847,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "telescope", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2017,12 +1859,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "telescope", Column: "observatory_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2030,12 +1871,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "telescope", Column: "name", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2043,12 +1883,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "telescope", Column: "telescope_type", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2056,12 +1895,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "telescope", Column: "mirror_diameter_m", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2069,12 +1907,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "telescope", Column: "status", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2082,12 +1919,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2095,12 +1931,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant", Column: "grant_number", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2108,12 +1943,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant", Column: "agency_id", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2121,12 +1955,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant", Column: "funding_amount", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2134,12 +1967,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant", Column: "start_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2147,12 +1979,11 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant", Column: "end_date", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, { @@ -2160,14 +1991,12 @@ func GetDefaultSyncJobMappings(schema string)[]*mgmtv1alpha1.JobMapping { Table: "grant", Column: "status", Transformer: &mgmtv1alpha1.JobMappingTransformer{ - Config: - &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ - PassthroughConfig: &mgmtv1alpha1.Passthrough{}, - }, + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, }, + }, }, }, } } -