defmodule FarmbotOS.Config.Repo.Migrations.SeedGroups do
  use Ecto.Migration

  def change do
    execute(
      "INSERT INTO groups (group_name, id) VALUES ('authorization', 1), ('hardware_params', 2), ('settings', 3);"
    )

    execute(
      "INSERT INTO bool_values (id, value) VALUES (16, 1), (17, 1), (18, 0);"
    )

    execute(
      "INSERT INTO float_values (id, value) VALUES (1, NULL), (2, NULL), (3, NULL), (4, NULL), (5, NULL), (6, NULL), (7, NULL), (8, NULL), (9, NULL), (10, NULL), (11, NULL), (12, NULL), (13, NULL), (14, NULL), (15, NULL), (16, NULL), (17, NULL), (18, NULL), (19, NULL), (20, NULL), (21, NULL), (22, NULL), (23, NULL), (24, NULL), (25, NULL), (26, NULL), (27, NULL), (28, NULL), (29, NULL), (30, NULL), (31, NULL), (32, NULL), (33, NULL), (34, NULL), (35, NULL), (36, NULL), (37, NULL), (38, NULL), (39, NULL), (40, NULL), (41, NULL), (42, NULL), (43, NULL), (44, NULL), (45, NULL), (46, NULL), (47, NULL), (48, NULL), (49, NULL), (50, NULL), (51, NULL), (52, NULL), (53, NULL), (54, NULL), (55, NULL), (56, NULL), (57, NULL), (58, NULL), (59, NULL), (60, NULL), (61, NULL), (62, NULL), (63, NULL), (64, NULL), (65, NULL), (66, NULL), (67, NULL), (68, NULL), (69, NULL), (70, NULL), (71, NULL), (72, NULL), (73, NULL), (74, NULL), (75, NULL), (76, NULL), (77, NULL), (78, NULL), (79, NULL), (80, NULL), (81, NULL), (82, NULL), (83, NULL), (84, NULL), (85, NULL), (86, NULL), (87, NULL), (88, NULL), (89, NULL), (92, NULL), (93, NULL), (94, NULL);"
    )

    execute(
      "INSERT INTO string_values (id, value) VALUES (1, 'https://my.farm.bot'), (2, NULL), (3, NULL), (4, NULL), (11, NULL), (12, '0.pool.ntp.org'), (13, '1.pool.ntp.org'), (14, 'my.farm.bot'), (15, NULL);"
    )

    execute(
      "INSERT INTO configs (bool_value_id, float_value_id, group_id, id, key, string_value_id) VALUES (NULL, NULL, 1, 1, 'server', 1), (NULL, NULL, 1, 2, 'email', 2), (NULL, NULL, 1, 3, 'password', 3), (NULL, NULL, 1, 4, 'token', 4), (NULL, 1, 2, 5, 'param_version', NULL), (NULL, 2, 2, 6, 'param_test', NULL), (NULL, 3, 2, 7, 'param_config_ok', NULL), (NULL, 4, 2, 8, 'param_use_eeprom', NULL), (NULL, 5, 2, 9, 'param_e_stop_on_mov_err', NULL), (NULL, 6, 2, 10, 'param_mov_nr_retry', NULL), (NULL, 7, 2, 11, 'movement_timeout_x', NULL), (NULL, 8, 2, 12, 'movement_timeout_y', NULL), (NULL, 9, 2, 13, 'movement_timeout_z', NULL), (NULL, 10, 2, 14, 'movement_keep_active_x', NULL), (NULL, 11, 2, 15, 'movement_keep_active_y', NULL), (NULL, 12, 2, 16, 'movement_keep_active_z', NULL), (NULL, 13, 2, 17, 'movement_home_at_boot_x', NULL), (NULL, 14, 2, 18, 'movement_home_at_boot_y', NULL), (NULL, 15, 2, 19, 'movement_home_at_boot_z', NULL), (NULL, 16, 2, 20, 'movement_invert_endpoints_x', NULL), (NULL, 17, 2, 21, 'movement_invert_endpoints_y', NULL), (NULL, 18, 2, 22, 'movement_invert_endpoints_z', NULL), (NULL, 19, 2, 23, 'movement_enable_endpoints_x', NULL), (NULL, 20, 2, 24, 'movement_enable_endpoints_y', NULL), (NULL, 21, 2, 25, 'movement_enable_endpoints_z', NULL), (NULL, 22, 2, 26, 'movement_invert_motor_x', NULL), (NULL, 23, 2, 27, 'movement_invert_motor_y', NULL), (NULL, 24, 2, 28, 'movement_invert_motor_z', NULL), (NULL, 25, 2, 29, 'movement_secondary_motor_x', NULL), (NULL, 26, 2, 30, 'movement_secondary_motor_invert_x', NULL), (NULL, 27, 2, 31, 'movement_steps_acc_dec_x', NULL), (NULL, 28, 2, 32, 'movement_steps_acc_dec_y', NULL), (NULL, 29, 2, 33, 'movement_steps_acc_dec_z', NULL), (NULL, 30, 2, 34, 'movement_stop_at_home_x', NULL), (NULL, 31, 2, 35, 'movement_stop_at_home_y', NULL), (NULL, 32, 2, 36, 'movement_stop_at_home_z', NULL), (NULL, 33, 2, 37, 'movement_home_up_x', NULL), (NULL, 34, 2, 38, 'movement_home_up_y', NULL), (NULL, 35, 2, 39, 'movement_home_up_z', NULL), (NULL, 36, 2, 40, 'movement_step_per_mm_x', NULL), (NULL, 37, 2, 41, 'movement_step_per_mm_y', NULL), (NULL, 38, 2, 42, 'movement_step_per_mm_z', NULL), (NULL, 39, 2, 43, 'movement_min_spd_x', NULL), (NULL, 40, 2, 44, 'movement_min_spd_y', NULL), (NULL, 41, 2, 45, 'movement_min_spd_z', NULL), (NULL, 42, 2, 46, 'movement_home_spd_x', NULL), (NULL, 43, 2, 47, 'movement_home_spd_y', NULL), (NULL, 44, 2, 48, 'movement_home_spd_z', NULL), (NULL, 45, 2, 49, 'movement_max_spd_x', NULL), (NULL, 46, 2, 50, 'movement_max_spd_y', NULL), (NULL, 47, 2, 51, 'movement_max_spd_z', NULL), (NULL, 48, 2, 52, 'encoder_enabled_x', NULL), (NULL, 49, 2, 53, 'encoder_enabled_y', NULL), (NULL, 50, 2, 54, 'encoder_enabled_z', NULL), (NULL, 51, 2, 55, 'encoder_type_x', NULL), (NULL, 52, 2, 56, 'encoder_type_y', NULL), (NULL, 53, 2, 57, 'encoder_type_z', NULL), (NULL, 54, 2, 58, 'encoder_missed_steps_max_x', NULL), (NULL, 55, 2, 59, 'encoder_missed_steps_max_y', NULL), (NULL, 56, 2, 60, 'encoder_missed_steps_max_z', NULL), (NULL, 57, 2, 61, 'encoder_scaling_x', NULL), (NULL, 58, 2, 62, 'encoder_scaling_y', NULL), (NULL, 59, 2, 63, 'encoder_scaling_z', NULL), (NULL, 60, 2, 64, 'encoder_missed_steps_decay_x', NULL), (NULL, 61, 2, 65, 'encoder_missed_steps_decay_y', NULL), (NULL, 62, 2, 66, 'encoder_missed_steps_decay_z', NULL), (NULL, 63, 2, 67, 'encoder_use_for_pos_x', NULL), (NULL, 64, 2, 68, 'encoder_use_for_pos_y', NULL), (NULL, 65, 2, 69, 'encoder_use_for_pos_z', NULL), (NULL, 66, 2, 70, 'encoder_invert_x', NULL), (NULL, 67, 2, 71, 'encoder_invert_y', NULL), (NULL, 68, 2, 72, 'encoder_invert_z', NULL), (NULL, 69, 2, 73, 'movement_axis_nr_steps_x', NULL), (NULL, 70, 2, 74, 'movement_axis_nr_steps_y', NULL), (NULL, 71, 2, 75, 'movement_axis_nr_steps_z', NULL), (NULL, 72, 2, 76, 'movement_stop_at_max_x', NULL), (NULL, 73, 2, 77, 'movement_stop_at_max_y', NULL), (NULL, 74, 2, 78, 'movement_stop_at_max_z', NULL), (NULL, 75, 2, 79, 'pin_guard_1_pin_nr', NULL), (NULL, 76, 2, 80, 'pin_guard_1_time_out', NULL), (NULL, 77, 2, 81, 'pin_guard_1_active_state', NULL), (NULL, 78, 2, 82, 'pin_guard_2_pin_nr', NULL), (NULL, 79, 2, 83, 'pin_guard_2_time_out', NULL), (NULL, 80, 2, 84, 'pin_guard_2_active_state', NULL), (NULL, 81, 2, 85, 'pin_guard_3_pin_nr', NULL), (NULL, 82, 2, 86, 'pin_guard_3_time_out', NULL), (NULL, 83, 2, 87, 'pin_guard_3_active_state', NULL), (NULL, 84, 2, 88, 'pin_guard_4_pin_nr', NULL), (NULL, 85, 2, 89, 'pin_guard_4_time_out', NULL), (NULL, 86, 2, 90, 'pin_guard_4_active_state', NULL), (NULL, 87, 2, 91, 'pin_guard_5_pin_nr', NULL), (NULL, 88, 2, 92, 'pin_guard_5_time_out', NULL), (NULL, 89, 2, 93, 'pin_guard_5_active_state', NULL), (16, NULL, 3, 116, 'fw_upgrade_migration', NULL), (NULL, 92, 2, 122, 'movement_invert_2_endpoints_x', NULL), (NULL, 93, 2, 123, 'movement_invert_2_endpoints_y', NULL), (NULL, 94, 2, 124, 'movement_invert_2_endpoints_z', NULL), (NULL, NULL, 1, 126, 'secret', 11), (NULL, NULL, 3, 127, 'default_ntp_server_1', 12), (NULL, NULL, 3, 128, 'default_ntp_server_2', 13), (NULL, NULL, 3, 129, 'default_dns_name', 14), (17, NULL, 3, 130, 'firmware_needs_flash', NULL), (NULL, NULL, 3, 131, 'update_channel', 15), (18, NULL, 3, 132, 'firmware_needs_open', NULL);"
    )
  end
end
