Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
change queue field data type from VARCHAR(20) to TEXT (issue #71) (#95)
* change queue size from 20 to 100 (issue #71)

* changed queue field data type to TEXT

* Added additional migration file + restored original v3 install file
  • Loading branch information
zhiyuanzhang-unai authored and vytautask committed Oct 16, 2018
1 parent d90118b commit bbfa20d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Hangfire.PostgreSql/Install.v10.sql
@@ -0,0 +1,15 @@
SET search_path = 'hangfire';
--
-- Table structure for table `Schema`
--

DO
$$
BEGIN
IF EXISTS (SELECT 1 FROM "schema" WHERE "version"::integer >= 9) THEN
RAISE EXCEPTION 'version-already-applied';
END IF;
END
$$;

ALTER TABLE "jobqueue" ALTER COLUMN "queue" TYPE TEXT;
17 changes: 17 additions & 0 deletions tests/Hangfire.PostgreSql.Tests/PostgreSqlJobQueueFacts.cs
Expand Up @@ -426,6 +426,23 @@ public void Enqueue_AddsAJobToTheQueue_WithoutUseNativeDatabaseTransactions()
Enqueue_AddsAJobToTheQueue(false);
}

[Fact, CleanDatabase]
public void Queues_Should_Support_Long_Queue_Names()
{
UseConnection(connection =>
{
var queue = CreateJobQueue(connection, false);
var name = "very_long_name_that_is_over_20_characters_long_or_something";
Assert.True(name.Length > 21);
queue.Enqueue(name, "1");
var record = connection.Query(@"select * from """ + GetSchemaName() + @""".""jobqueue""").Single();
Assert.Equal(name, record.queue.ToString());
});
}

private void Enqueue_AddsAJobToTheQueue(bool useNativeDatabaseTransactions)
{
Expand Down

0 comments on commit bbfa20d

Please sign in to comment.