Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.1
-
Fix Version/s: 1.2.2
-
Component/s: Import/Export
-
Labels:None
Description
Dears,
Let's say you create your database first. If you have a serial/bigserial, a sequence is automaticaly created. It's called for example: 'id_seq'
During the cretion of the model, the sequence name is, so, called id_seq.
But in Doctrine_Formatter, line 233, you have getSequenceName that format Doctrine_Core::ATTR_SEQNAME_FORMAT that comes from Doctrine_Manager line 143, you have Doctrine_Core::ATTR_SEQNAME_FORMAT => "%s_seq", so, the sequence name will wrongly be id_seq_seq.
This could be avoid if the sequence_name would not contain the "_seq" suffix coming from the import. WDYT?
This could be possible thanks to a change in Doctrine_Import_Pgsql, line 50:
'listSequences' => "SELECT
rtrim(relname, '_seq')
FROM
pg_class
WHERE relkind = 'S' AND relnamespace IN
(SELECT oid FROM pg_namespace
WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema')",
So, rtrim(relname, '_seq') in place of relname only.
I'm not sure rtrim is the best solution but you got what I meant.
Voilà my 2 cents.
Hope it will help
Best regards,
Raphaël Dehousse
Here is a patch to apply in the doctrine lib directory