Skip to content

Commit bbfa20d

Browse files
zhiyuanzhang-unaivytautask
authored andcommitted
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
1 parent d90118b commit bbfa20d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
SET search_path = 'hangfire';
2+
--
3+
-- Table structure for table `Schema`
4+
--
5+
6+
DO
7+
$$
8+
BEGIN
9+
IF EXISTS (SELECT 1 FROM "schema" WHERE "version"::integer >= 9) THEN
10+
RAISE EXCEPTION 'version-already-applied';
11+
END IF;
12+
END
13+
$$;
14+
15+
ALTER TABLE "jobqueue" ALTER COLUMN "queue" TYPE TEXT;

tests/Hangfire.PostgreSql.Tests/PostgreSqlJobQueueFacts.cs

+17
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,23 @@ public void Enqueue_AddsAJobToTheQueue_WithoutUseNativeDatabaseTransactions()
426426
Enqueue_AddsAJobToTheQueue(false);
427427
}
428428

429+
[Fact, CleanDatabase]
430+
public void Queues_Should_Support_Long_Queue_Names()
431+
{
432+
UseConnection(connection =>
433+
{
434+
var queue = CreateJobQueue(connection, false);
435+
436+
var name = "very_long_name_that_is_over_20_characters_long_or_something";
437+
438+
Assert.True(name.Length > 21);
439+
440+
queue.Enqueue(name, "1");
441+
442+
var record = connection.Query(@"select * from """ + GetSchemaName() + @""".""jobqueue""").Single();
443+
Assert.Equal(name, record.queue.ToString());
444+
});
445+
}
429446

430447
private void Enqueue_AddsAJobToTheQueue(bool useNativeDatabaseTransactions)
431448
{

0 commit comments

Comments
 (0)