UPDATE `settings` SET `payload` = '6.5' WHERE `settings`.`name` = 'current_version';

INSERT INTO `settings` (`group`, `name`, `locked`, `payload`, `created_at`, `updated_at`) VALUES ('general', 'active_theme', 0, 'easyship', current_timestamp(), current_timestamp());

INSERT INTO `permissions` (`name`, `guard_name`, `permission_group_id`, `created_at`, `updated_at`) VALUES ('update-system', 'web', 1, current_timestamp(), current_timestamp());
INSERT INTO `permissions` (`name`, `guard_name`, `permission_group_id`, `created_at`, `updated_at`) VALUES ('import-shipments', 'web', 8, current_timestamp(), current_timestamp());

SET @dbname = DATABASE();
SET @tablename = "currencies";
SET @columnname = "default";
SET @preparedStatement = (SELECT IF(
  (
    SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
    WHERE
      (table_name = @tablename)
      AND (table_schema = @dbname)
      AND (column_name = @columnname)
  ) > 0,
  "SELECT 1",
  CONCAT("ALTER TABLE ", @tablename, " ADD ", @columnname, " DOUBLE  0;")
));
PREPARE alterIfNotExists FROM @preparedStatement;
EXECUTE alterIfNotExists;
DEALLOCATE PREPARE alterIfNotExists;

COMMIT;