text: SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  START TRANSACTION;
  SET TIME_ZONE='+3:00';
  
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!40101 SET NAMES utf8mb4 */;
  
  --
  -- Banco de dados: `nuuvem`
  --
  -- --------------------------------------------------------
  
  --
  -- Estrutura da tabela `jobs`
  --
  
  CREATE TABLE IF NOT EXISTS `jobs` (
    `uuid` varchar(255) NOT NULL,
    `file_name` varchar(255) NOT NULL,
    `size` int(11) NOT NULL,
    `number_of_lines` int(11),
    `gross` decimal(10,2) NOT NULL DEFAULT 0.00,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
    `user_uid` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Estrutura da tabela `sales`
  --
  
  CREATE TABLE IF NOT EXISTS `sales` (
    `purchaser_name` varchar(255) NOT NULL,
    `item_description` varchar(255) NOT NULL,
    `item_price` decimal(10,2) NOT NULL,
    `purchase_count` int(11) NOT NULL,
    `merchant_address` varchar(255) NOT NULL,
    `merchant_name` varchar(255) NOT NULL,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
    `job_uuid` varchar(255) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Estrutura da tabela `users`
  --
  
  CREATE TABLE IF NOT EXISTS `users` (
    `provider` varchar(15) NOT NULL DEFAULT 'email',
    `uid` varchar(255) NOT NULL DEFAULT '',
    `encrypted_password` varchar(255) NOT NULL DEFAULT '',
    `reset_password_token` varchar(255),
    `reset_password_sent_at` varchar(255),
    `allow_password_change` tinyint(1) NOT NULL DEFAULT 0,
    `remember_created_at` datetime,
    `confirmation_token` varchar(255),
    `confirmed_at` datetime,
    `confirmation_sent_at` datetime,
    `unconfirmed_email` varchar(255),
    `name` varchar(255) NOT NULL,
    `last_name` varchar(255) NOT NULL,
    `nickname` varchar(255),
    `image` varchar(255),
    `email` varchar(255) NOT NULL,
    `sign_in_count` int(11) NOT NULL DEFAULT 0,
    `current_sign_in_at` datetime,
    `last_sign_in_at` datetime,
    `current_sign_in_ip` varchar(255),
    `last_sign_in_ip` varchar(255),
    `tokens` text,
    `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
    `updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  DROP PROCEDURE IF EXISTS `DropIndexIfExists`;
  DELIMITER $$
  CREATE PROCEDURE `DropIndexIfExists`(
  		IN i_table_name VARCHAR(128),
  		IN i_index_name VARCHAR(128)
      )
  BEGIN
  		SET @tableName = i_table_name;
  		SET @indexName = i_index_name;
  		SET @indexExists = 0;
          
          SELECT 
  			1
  		INTO @indexExists FROM
  			INFORMATION_SCHEMA.STATISTICS
  		WHERE
  			TABLE_NAME = @tableName
  				AND INDEX_NAME = @indexName;
              
  		SET @query = CONCAT(
          'DROP INDEX ', @indexName, ' ON ', @tableName
  		);
          
          IF @indexExists THEN
  			PREPARE stmt FROM @query;
  			EXECUTE stmt;
  			DEALLOCATE PREPARE stmt;
  		END IF;
  END $$
  DELIMITER ;
  
  --
  -- Índices para tabela `jobs`
  --
  -- DROP INDEX IF EXISTS `PRIMARY` ON `jobs`;
  -- DROP INDEX IF EXISTS `FK_USER_JOBS` ON `jobs`;
  CALL DropIndexIfExists('jobs', 'PRIMARY');
  CALL DropIndexIfExists('jobs', 'FK_USER_JOBS');
  ALTER TABLE `jobs`
    ADD PRIMARY KEY (`uuid`),
    ADD KEY `FK_USER_JOBS` (`user_uid`);
  
  --
  -- Índices para tabela `sales`
  --
  -- DROP INDEX IF EXISTS `PRIMARY` ON `sales`;
  -- DROP INDEX IF EXISTS `FK_JOB_SALES` ON `sales`;
  CALL DropIndexIfExists('sales', 'PRIMARY');
  CALL DropIndexIfExists('sales', 'FK_JOB_SALES');
  ALTER TABLE `sales`
    ADD KEY `FK_JOB_SALES` (`job_uuid`);
  
  --
  -- Índices para tabela `users`
  --
  -- DROP INDEX IF EXISTS `FK_JOB_SALES` ON `sales`;
  CALL DropIndexIfExists('users', 'PRIMARY');
  ALTER TABLE `users`
    ADD PRIMARY KEY (`uid`);
  
  LOCK TABLES `users` WRITE;
  /*!40000 ALTER TABLE `users` DISABLE KEYS */;
  INSERT INTO `users` VALUES ('email','teste@teste.com','$2a$11$PQcT6nckT6y44NHdsVYWrO.oNFolizRThQFji.sL0zY2BG0FHXVqe',NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,'Teste','Teste',NULL,NULL,'teste@teste.com',1,'2021-07-09 00:52:56','2021-07-09 00:52:56','172.18.0.1','172.18.0.1','{\"qg3wRuVFATkzVIaBXngNYg\":{\"token\":\"$2a$10$63GP91MuoSqFdKUgLAmfh.bawOnwFy6HvPs6iZouazE7TAmsI/zZy\",\"expiry\":1627001489},\"PkY-d4u0DqrdyuVV8KGYpg\":{\"token\":\"$2a$10$T5NpjrVcuSLlHFiM5M6XPeVO9JlXyXN2XuBHO3meJKSUVpDlUQh66\",\"expiry\":1627001576}}','2021-07-09 00:51:29','2021-07-09 00:52:56');
  INSERT INTO `users` VALUES ('email','outro_teste@teste.com','$2a$11$PQcT6nckT6y44NHdsVYWrO.oNFolizRThQFji.sL0zY2BG0FHXVqe',NULL,NULL,0,NULL,NULL,NULL,NULL,NULL,'Teste','Teste',NULL,NULL,'outro_teste@teste.com',1,'2021-07-09 00:52:56','2021-07-09 00:52:56','172.18.0.1','172.18.0.1','{\"qg3wRuVFATkzVIaBXngNYg\":{\"token\":\"$2a$10$63GP91MuoSqFdKUgLAmfh.bawOnwFy6HvPs6iZouazE7TAmsI/zZy\",\"expiry\":1627001489},\"PkY-d4u0DqrdyuVV8KGYpg\":{\"token\":\"$2a$10$T5NpjrVcuSLlHFiM5M6XPeVO9JlXyXN2XuBHO3meJKSUVpDlUQh66\",\"expiry\":1627001576}}','2021-07-09 00:51:29','2021-07-09 00:52:56');
  /*!40000 ALTER TABLE `users` ENABLE KEYS */;
  UNLOCK TABLES;
  /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  
  COMMIT;
  
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  