(queueName string)
| 222 | } |
| 223 | |
| 224 | func generateCreateTableQueryCompositeIndex(queueName string) string { |
| 225 | quotedTableName := pg.QuoteIdentifier(queueName) |
| 226 | return fmt.Sprintf(`CREATE TABLE IF NOT EXISTS %[1]s |
| 227 | ( |
| 228 | id UUID DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY, |
| 229 | created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL, |
| 230 | started_at TIMESTAMPTZ NULL, |
| 231 | locked_until TIMESTAMPTZ NULL, |
| 232 | processed_at TIMESTAMPTZ NULL, |
| 233 | consumed_count INTEGER DEFAULT 0 NOT NULL, |
| 234 | error_detail TEXT NULL, |
| 235 | payload JSONB NOT NULL, |
| 236 | metadata JSONB NOT NULL |
| 237 | ); |
| 238 | CREATE INDEX IF NOT EXISTS "%[2]s_created_at_idx" ON %[1]s (created_at); |
| 239 | CREATE INDEX IF NOT EXISTS "%[2]s_processed_at_null_idx" ON %[1]s (consumed_count, processed_at) WHERE (processed_at IS NULL); |
| 240 | `, quotedTableName, quotedTableName[1:len(quotedTableName)-1]) |
| 241 | } |
| 242 | |
| 243 | func generateCreateTablePartitionedQuery(queueName string) string { |
| 244 | quotedTableName := pg.QuoteIdentifier(queueName) |
no test coverage detected