44
55use Doctrine \DBAL \Connection ;
66use Doctrine \DBAL \Schema \Table ;
7+ use Doctrine \DBAL \Types \Type ;
78use Interop \Queue \InvalidDestinationException ;
89use Interop \Queue \PsrContext ;
910use Interop \Queue \PsrDestination ;
@@ -171,16 +172,18 @@ public function createDataBaseTable()
171172 }
172173
173174 $ table = new Table ($ this ->getTableName ());
174- $ table ->addColumn ('id ' , 'guid ' );
175- $ table ->addColumn ('published_at ' , 'bigint ' );
176- $ table ->addColumn ('body ' , 'text ' , ['notnull ' => false ]);
177- $ table ->addColumn ('headers ' , 'text ' , ['notnull ' => false ]);
178- $ table ->addColumn ('properties ' , 'text ' , ['notnull ' => false ]);
179- $ table ->addColumn ('redelivered ' , 'boolean ' , ['notnull ' => false ]);
180- $ table ->addColumn ('queue ' , 'string ' );
181- $ table ->addColumn ('priority ' , 'smallint ' );
182- $ table ->addColumn ('delayed_until ' , 'integer ' , ['notnull ' => false ]);
183- $ table ->addColumn ('time_to_live ' , 'integer ' , ['notnull ' => false ]);
175+
176+ $ table ->addColumn ('id ' , Type::BINARY , ['length ' => 16 , 'fixed ' => true ]);
177+ $ table ->addColumn ('human_id ' , Type::STRING , ['length ' => 36 ]);
178+ $ table ->addColumn ('published_at ' , Type::BIGINT );
179+ $ table ->addColumn ('body ' , Type::TEXT , ['notnull ' => false ]);
180+ $ table ->addColumn ('headers ' , Type::TEXT , ['notnull ' => false ]);
181+ $ table ->addColumn ('properties ' , Type::TEXT , ['notnull ' => false ]);
182+ $ table ->addColumn ('redelivered ' , Type::BOOLEAN , ['notnull ' => false ]);
183+ $ table ->addColumn ('queue ' , Type::STRING );
184+ $ table ->addColumn ('priority ' , Type::SMALLINT );
185+ $ table ->addColumn ('delayed_until ' , Type::INTEGER , ['notnull ' => false ]);
186+ $ table ->addColumn ('time_to_live ' , Type::INTEGER , ['notnull ' => false ]);
184187
185188 $ table ->setPrimaryKey (['id ' ]);
186189 $ table ->addIndex (['published_at ' ]);
@@ -190,4 +193,16 @@ public function createDataBaseTable()
190193
191194 $ sm ->createTable ($ table );
192195 }
196+
197+ /**
198+ * @param DbalDestination $queue
199+ */
200+ public function purgeQueue (DbalDestination $ queue )
201+ {
202+ $ this ->getDbalConnection ()->delete (
203+ $ this ->getTableName (),
204+ ['queue ' => $ queue ->getQueueName ()],
205+ ['queue ' => Type::STRING ]
206+ );
207+ }
193208}
0 commit comments