Esempio n. 1
0
        public void CreateOutboxTable()
        {
            using (var connection = new MySqlConnection(_mysqlSettings.TestsBrighterConnectionString))
            {
                _tableName = $"`message_{_tableName}`";
                var createTableSql = MySqlOutboxBuilder.GetDDL(_tableName);

                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = createTableSql;
                    command.ExecuteNonQuery();
                }
            }
        }
Esempio n. 2
0
        private static void CreateOutboxProduction(string connectionString)
        {
            using var sqlConnection = new MySqlConnection(connectionString);
            sqlConnection.Open();

            using var existsQuery   = sqlConnection.CreateCommand();
            existsQuery.CommandText = MySqlOutboxBuilder.GetExistsQuery(OUTBOX_TABLE_NAME);
            bool exists = existsQuery.ExecuteScalar() != null;

            if (exists)
            {
                return;
            }

            using var command   = sqlConnection.CreateCommand();
            command.CommandText = MySqlOutboxBuilder.GetDDL(OUTBOX_TABLE_NAME);
            command.ExecuteScalar();
        }
Esempio n. 3
0
 private static void CreateMessageTable(string dbConnectionString, string tableNameMessages)
 {
     try
     {
         using (var sqlConnection = new MySqlConnection(dbConnectionString))
         {
             sqlConnection.Open();
             using (var command = sqlConnection.CreateCommand())
             {
                 command.CommandText = MySqlOutboxBuilder.GetDDL(tableNameMessages);
                 command.ExecuteScalar();
             }
         }
     }
     catch (System.Exception e)
     {
         Log.Error($"Issue with creating MessageStore table, {e.Message}");
     }
 }
Esempio n. 4
0
 private static void CreateMessageTable(string dbConnectionString, string tableNameMessages)
 {
     try
     {
         using (var sqlConnection = new MySqlConnection(dbConnectionString))
         {
             sqlConnection.Open();
             using (var command = sqlConnection.CreateCommand())
             {
                 command.CommandText = MySqlOutboxBuilder.GetDDL(tableNameMessages);
                 command.ExecuteScalar();
             }
         }
     }
     catch (System.Exception e)
     {
         //TODO: Ignore already exists messages for now, but we should really test for exists before creating
         Log.Error($"Issue with creating MessageStore table, {e.Message}");
     }
 }