arnoldasgudas / Hangfire.MySqlStorage

MySql storage for Hangfire - fire-and-forget, delayed and recurring tasks runner
GNU Lesser General Public License v3.0
175 stars 114 forks source link

hangfirestate table doesn't exist #77

Closed micro9000 closed 3 years ago

micro9000 commented 3 years ago

MySqlConnector.MySqlException: Table 'plst_hangfirestorage.hangfirestate' doesn't exist The created table is hangfirejobstate

using Hangfire;
using Hangfire.MySql;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;

namespace Hangfire
{
    class Program
    {
        static void Main (string[] args)
        {
            GlobalConfiguration.Configuration.UseStorage(
                        new MySqlStorage(
                            "Server=127.0.0.1; Port=3306;Database=PLST_HangfireStorage;Uid=root;password=;Persist Security Info=True;Allow Zero Datetime=True;CharSet=utf8;Allow User Variables=True",
                            new MySqlStorageOptions
                            {
                                TransactionIsolationLevel = IsolationLevel.ReadCommitted,
                                QueuePollInterval = TimeSpan.FromSeconds(15),
                                JobExpirationCheckInterval = TimeSpan.FromHours(1),
                                CountersAggregateInterval = TimeSpan.FromMinutes(5),
                                PrepareSchemaIfNecessary = true,
                                DashboardJobListLimit = 50000,
                                TransactionTimeout = TimeSpan.FromMinutes(1),
                                TablesPrefix = "Hangfire"
                            }));

            BackgroundJob.Enqueue(() => Console.WriteLine("Hello, world!"));

            using (var server = new BackgroundJobServer())
            {
                Console.ReadLine();
            }
        }
    }
}