Пример #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();
                }
            }
        }
Пример #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();
        }
Пример #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}");
     }
 }
Пример #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}");
     }
 }