[DBAL-57] Handling of Quoted Elements Created: 30/Oct/10 Updated: 30/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.0.0-BETA4 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Handling of Quoted Table, Column (etc) names is not as good as it could be. Any input is currently accepted, however it is not processed further and used in conjunction with the platform. |
[DBAL-96] Make approach towards identifier quoting consistent Created: 26/Feb/11 Updated: 20/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms, Schema Managers |
| Affects Version/s: | None |
| Fix Version/s: | 2.4 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Benjamin Eberlei | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
Problem: Schema is independent of a vendor, this means we have to pick a behavior, i propose SQL-92
This means:
In conjunction with the SQL reserved keywords tickets we can then improve the DatabaseDriver considerably to detect identifier casings |
[DBAL-377] Rename Table foreignkey not changed Created: 07/Nov/12 Updated: 21/Nov/12 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Manuel | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
if i want to change a tablename the foreign key doesnt change and i get an error $config = new Doctrine\DBAL\Configuration(); } ################################################## PDOException: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'doc_xml_consultant_new' already exists in /Applications/MAMP/bin/php/php5.3.14/lib/php/Doctrine/DBAL/Connection.php on line 646 Call Stack: 0.0430 771936 2. require_once('/PATH/TO/jobs/config.php') /PATH/TO/jobs/import.php:7 0.0528 775448 3. require_once('/PATH/TO/jobs/bootstrap.php') /PATH/TO/jobs/config.php:3 0.0623 812680 4. require_once('/PATH/TO/jobs/bootstrap_doctrine.php') /PATH/TO/jobs/bootstrap.php:5 16.7866 16304048 5. Doctrine\ORM\Tools\SchemaTool->createSchema() /PATH/TO/jobs/bootstrap_doctrine.php:70 16.8798 16562624 6. Doctrine\DBAL\Connection->executeQuery() /Applications/MAMP/bin/php/php5.3.14/lib/php/Doctrine/ORM/Tools/SchemaTool.php:90 16.8804 16564080 7. PDO->query() /Applications/MAMP/bin/php/php5.3.14/lib/php/Doctrine/DBAL/Connection.php:646 Doctrine\DBAL\DBALException: An exception occurred while executing 'CREATE TABLE doc_xml_consultant_new (id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, lastCommaFirstName VARCHAR(255) DEFAULT NULL, education LONGTEXT DEFAULT NULL, workHistory LONGTEXT DEFAULT NULL, imageStandard VARCHAR(255) DEFAULT NULL, imageWide VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB': SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'doc_xml_consultant_new' already exists in /Applications/MAMP/bin/php/php5.3.14/lib/php/Doctrine/DBAL/DBALException.php on line 47 Call Stack: 0.0178 766208 1. {main} () /PATH/TO/jobs/import.php:0 Doctrine\ORM\Tools\ToolsException: Schema-Tool failed with Error 'An exception occurred while executing 'CREATE TABLE doc_xml_consultant_new (id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, lastCommaFirstName VARCHAR(255) DEFAULT NULL, education LONGTEXT DEFAULT NULL, workHistory LONGTEXT DEFAULT NULL, imageStandard VARCHAR(255) DEFAULT NULL, imageWide VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB': SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'doc_xml_consultant_new' already exists' while executing DDL: CREATE TABLE doc_xml_consultant_new (id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, lastCommaFirstName VARCHAR(255) DEFAULT NULL, education LONGTEXT DEFAULT NULL, workHistory LONGTEXT DEFAULT NULL, imageStandard VARCHAR(255) DEFAULT NULL, imageWide VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB in /Applications/MAMP/bin/php/php5.3.14/lib/php/Doctrine/ORM/Tools/ToolsException.php on line 33 Call Stack: () /PATH/TO/jobs/import.php:0 |
| Comments |
| Comment by Manuel [ 07/Nov/12 ] |
|
now i find a way to rename the table and then rename. else this would be a good feature |
[DBAL-367] Reverse engnering do not work with Oracle DB Created: 18/Oct/12 Updated: 23/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Drivers, Schema Managers |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Zelenin Alexandr | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Cli, oracle, schematool | ||
| Environment: |
PHP 5.3.3-1ubuntu9.10 with Suhosin-Patch (cli) (built: Feb 11 2012 06:21:15) |
||
| Description |
$ doctrine orm:convert-mapping --filter="ms$ions" xml .
[Doctrine\DBAL\DBALException]
Unknown database type binary_float requested, Doctrine\DBAL\Platforms\OraclePlatform may not support it.
cli-config.php: use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\AnnotationRegistry; require_once 'Doctrine/Common/ClassLoader.php'; define('APPLICATION_ENV', "development"); error_reporting(E_ALL); $classLoader = new \Doctrine\Common\ClassLoader('Doctrine'); $classLoader->register(); $config = new \Doctrine\ORM\Configuration(); $config->setProxyDir(__DIR__); $config->setProxyNamespace('Proxies'); $config->setAutoGenerateProxyClasses((APPLICATION_ENV == "development")); AnnotationRegistry::registerFile("Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); $reader = new AnnotationReader(); $driverImpl = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, array(__DIR__ . "/../php/ru/niifhm/bioinformatics/biodb/model")); $config->setMetadataDriverImpl($driverImpl); if (APPLICATION_ENV == "development") { $cache = new \Doctrine\Common\Cache\ArrayCache(); } else { $cache = new \Doctrine\Common\Cache\ApcCache(); } $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $connectionOptions = array( 'driver' => 'oci8', 'host' => 'host.name', 'dbname' => 'db.name', 'user' => 'user.name', 'password' => 'user.password' ); $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config); $platform = $em->getConnection()->getDatabasePlatform(); $platform->registerDoctrineTypeMapping('enum', 'string'); $em->getConfiguration()->setMetadataDriverImpl( new \Doctrine\ORM\Mapping\Driver\DatabaseDriver( $em->getConnection()->getSchemaManager() ) ); $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array( 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) )); |
| Comments |
| Comment by Marco Pivetta [ 23/Jan/13 ] |
|
Formatting |
[DBAL-234] Index names are not synchronized by Comparator Created: 08/Mar/12 Updated: 08/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Artem Goutsoul | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MySQL |
||
| Description |
|
Index and foreign key name change is not synced by Comparator. This is important since in some complex queries one might use FORCE INDEX (some_index_name), and they will fail if an index name is incorrect. |
[DBAL-235] Column order is not synchronized by Comparator Created: 08/Mar/12 Updated: 03/Apr/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Artem Goutsoul | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
MySQL |
||
| Description |
|
Comparator does not synchronize column order. It would be great if it did. |
| Comments |
| Comment by Chris Woodford [ 02/Apr/12 ] |
|
I assume that this means adding AFTER to any ALTER ADD statements? if so, this is something that i would really appreciate as well |
| Comment by Artem Goutsoul [ 03/Apr/12 ] |
|
Yup, that's exactly what I meant! |
[DBAL-232] Custom commented column type removal causes unknown column type exception Created: 06/Mar/12 Updated: 09/Mar/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.2.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Aigars Gedroics | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Problem happens when initially, as example, there was commented type "foo" registered and used: Doctrine\DBAL\Types\Type::addType('foo', 'FooType');
$em->getConnection()
->getDatabasePlatform()
->markDoctrineTypeCommented(Doctrine\DBAL\Types\Type::getType('foo'));
When the type usage and declaration is removed, the database schema upgrade fails. I suggest ignoring the database column comment and stick to the standard type recognition in case the type is not declared. |
| Comments |
| Comment by Aigars Gedroics [ 09/Mar/12 ] |
|
Trivial solution would be: --- a/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -878,7 +878,9 @@ abstract class AbstractSchemaManager public function extractDoctrineTypeFromComment($comment, $currentType) { if (preg_match("(\(DC2Type:([a-zA-Z0-9]+)\))", $comment, $match)) { - $currentType = $match[1]; + if (Types\Type::hasType($match[1])) { + $currentType = $match[1]; + } } return $currentType; } |
[DBAL-58] Schema tool does not see difference between onDelete="NO ACTION" and onDelete="RESTRICT" Created: 11/Aug/10 Updated: 31/Oct/10 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Jan Obrátil | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
If database has ON DELETE CASCADE, schema tool detects change to NO ACTION and RESCRICT. Detecting of changes is done by: |
| Comments |
| Comment by Benjamin Eberlei [ 11/Aug/10 ] |
|
which database version do yo uuse? can you paste an example schema? |
| Comment by Jan Obrátil [ 11/Aug/10 ] |
|
This is example script with 2 testing entities. |
| Comment by Jan Obrátil [ 11/Aug/10 ] |
|
I have attached script with two entities. I have this database version: Check line 44. There is CASCADE. Change CASCADE to NO ACTION everything ok, so: $ doctrine orm:schema-tool:update Change NO ACTION to RESTRICT Change RESTRICT to CASCADE everything ok, so: $ doctrine orm:schema-tool:update Change CASCADE to RESTRICT everything ok, do: $ doctrine orm:schema-tool:update Change RESTRICT to NO ACTION So there is no way to update database schema from RESTRICT to NO ACTION and reverse! |
| Comment by Benjamin Eberlei [ 31/Oct/10 ] |
|
Hm you are right, however for MySQL NO ACTION is the same as RESTRICT as stated by http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html |
[DBAL-404] Support of index length for text fields Created: 29/Dec/12 Updated: 29/Dec/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Maksim Lunochkin | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
For table with text field description with index on it generated query is: CREATE TABLE t (id INT UNSIGNED AUTO_INCREMENT NOT NULL, description LONGTEXT DEFAULT NULL, number INT DEFAULT NULL, INDEX index2 (description), INDEX index3 (description, number), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB This query lead to error, because for index on text field absented key length. |
[DBAL-477] Just doublequote all schema names and field names in PostgreSQL sql command generation, and the same for MySQL Created: 28/Mar/13 Updated: 28/Mar/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms, Schema Managers |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | jos de witte | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | mysql, postgresql | ||
| Environment: |
Any PostgreSQL environment |
||
| Description |
|
Generation of any SQL command to the database (From entities or migration versions) does not quote all the reserved keywords (For example a fieldname `right`. Simple fix that always works: double-quote dbname, schemaname and fieldname e.g "dbsecurity"."userschema"."users" or "tblusers" MySQL : use the ` sign. e.g `security`.`users` or `tblusers` (No support for schemas since I last checked some time ago) |
[DBAL-472] Oracle schema modification - incorrect SQL to change the nullable status of column Created: 26/Mar/13 Updated: 04/Apr/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Andy Park | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Centos 6 PHP 5.3.3 Oracle 11g |
||
| Description |
|
When updating the nullable status of a column the sql generated is ALTER TABLE MET MODIFY (METAR VARCHAR2(2000) DEFAULT NULL) This will set the default column value to null but does not modify the nullable status of the column. The correct sql would be ALTER TABLE MET MODIFY (METAR VARCHAR2(2000) NULL) The field definition changed from
to
|
| Comments |
| Comment by Benjamin Eberlei [ 04/Apr/13 ] |
|
Works for me strangely. |
[DBAL-474] SchemaManager / Connection on PostgreSQL platform does not respect filterExpression for sequences Created: 27/Mar/13 Updated: 24/Apr/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | jos de witte | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | postgresql, schematool | ||
| Environment: |
Windows & Linux |
||
| Description |
|
Dear Symfony team, the filterExpression on AbstractSchemaManager seems not to work for sequences. This only happens under postgres. It seems the way the sequences are handled are the culprit: It tries to get min_value etc of sequences without matching sequence names to the filter expression in advance. If for example access to the sequences is denied, (Different schema without permissions for the current entity manager), any higher-level ORM operations like generating migration versions fail. --------------------- UPDATE the context is when using migrations. Positive regexp expressions do not limit the migration to a single schema. eg ^schemaname.$ |
| Comments |
| Comment by Benjamin Eberlei [ 14/Apr/13 ] |
|
Can you paste an exception trace? I see that filtering is applied to sequences, but your description seems to indicate this happens due to an SQL query much earlier? |
| Comment by jos de witte [ 24/Apr/13 ] |
|
Dear Benjamin, the context is when using migrations. Positive regexp expressions do not limit the migration to a single schema. eg ^schemaname.$ |
[DBAL-505] Issue whenusing serial columns in PostgreSQL Created: 24/Apr/13 Updated: 24/Apr/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Drivers, Platforms, Schema Managers |
| Affects Version/s: | 2.3.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | jos de witte | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
PostgreSQL |
||
| Description |
|
When using Doctrine ORM mapping fields like this: /**
It first creates the migration perfectly as a serial column with the correct schema. However when making a new migration diff it generates DROP statements for every sequence for these id, so we have to remove them manually every time. |
[DBAL-407] Refactor exceptions Created: 07/Jan/13 Updated: 06/May/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Drivers, Platforms, Schema Managers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Bart van den Burg | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
It's currently rather hard to figure out what went wrong when for example a DBALException was thrown. You have to actually match the message in it, or read the status code of the ->getPrevious() exception, which can be different for all drivers (as https://github.com/jackalope/jackalope-doctrine-dbal/issues/80 shows). I'd suggest creating new exception classes for all situations and throwing them instead. If they extend the DBAL Exception and pass the message to it as it is right now, there will be no BC break. If this were to be done, on which branch should this be applied? |
| Comments |
| Comment by Christophe Coevoet [ 07/Jan/13 ] |
|
This should be done in the master branch. Another solution, avoiding to create many classes, would be to use the exception code, which is always kept as 0 currently (the default value of the Exception class). You could have a code for each case (with constants in the DBALException class) and then checking $e->getCode() to identify what went wrong. |
| Comment by Bart van den Burg [ 07/Jan/13 ] |
|
I'd prefer actual named exceptions. It makes catching them simpler. However, adding some code defined in DBAL would be an acceptable alternative. try { /* ... /* } catch (NoSuchTableException $e) { // do something } catch (DuplicateKeyException $e) { // do something else } v.s. try { /* ... /* } catch (DBALException $e) { if ($e->getCode() == DBALException::NO_SUCH_TABLE) { // do something } elseif ($e->getCode() == DBALException::DUPLICATE_KEY) { // do something else } else { throw $e; } } |
| Comment by Christopher Davis [ 06/May/13 ] |
|
I would also prefer named exceptions. You're going to have a lot of problems providing the "code" value in DBALException in any case: SQLSTATE codes are alphanumeric, and will cause warnings/errors when creating new exception. Besides we can get the SQL state code now: try {
// ...
} catch (\Doctrine\DBAL\DBALException $e) {
$code = $e->getPrevious()->getCode();
// do stuff with $code
}
The problem is that there are a lot of error codes defined in the ANSI SQL standard: http://www.postgresql.org/docs/9.2/static/errcodes-appendix.html Maybe throwing an specific exception for each "class" of SQLSTATE codes? So if the error code from a PDO exception starts with 23, DBAL would throw `\Doctrine\DBAL\Exception\IntegrityConstraintViolationException`. This also seems like the logic to handle throwing exceptions should be contained in the platforms as some implementations may differ. You could have a method in `AbstractPlatform` that takes care of the ANSI SQLSTATE error code classes and leave it up subclasses to deal with platform specific cases. Whenever `Connection` catches a `PDOException`, dispatch it to the platform to deal with. Example: https://gist.github.com/chrisguitarguy/e021918900e93dca304d Thoughts? |
| Comment by Matthieu Napoli [ 06/May/13 ] |
|
I have implemented a thing of that kind in a personal project (on top of Doctrine). It is really useful to be able to catch a ForeignKeyViolationException, and get with entity/field caused the problem (for that my EntityManager wrapper parse the exception message). However, note that exception codes differ from DB engines. In my case, I did it quick and used MySQL error codes, but managing different RDBMS implies more work. |
[DBAL-504] DBAL Enum fields migration issue / PostgreSQL Created: 24/Apr/13 Updated: 06/May/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine DBAL |
| Component/s: | Drivers, Schema Managers |
| Affects Version/s: | 2.3.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | jos de witte | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Environment: |
postgresql |
||
| Issue Links: |
|
||||||||
| Description |
|
When using Custom Doctrine DBAL Enums the migration created using diff works fine the first time. However the next time it generates a SQL statement trying to change to field type to INT from integer; (Redundant) "ALTER schemaname.fieldname SET" .. And that's it. |
| Comments |
| Comment by Tom Vogt [ 01/May/13 ] |
|
Doesn't only happen on Enums. I don't use any enums and I have this problem. I use a couple of geo (postGIS) fields (point, linestring, polygon) as well as array fields, so either or all of those might be causing it, too. |
| Comment by Benjamin Eberlei [ 04/May/13 ] |
|
We did some changes for PostgreSQL column diffs lately, can you verify this bug still exists on the 2.3 Branch of DBAL? |
| Comment by Tom Vogt [ 06/May/13 ] |
|
I'm running this on Symfony2 with this composer.json config: "doctrine/orm": "2.3.*", and I'm still getting this issue today. |
[DBAL-175] Table comments in Doctrine\DBAL\Schema\Table Object Created: 06/Oct/11 Updated: 17/Oct/11 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms, Schema Managers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Asmir Mustafic | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Should be useful discover the table comments from database schema. This feature is already available for column comments, but not for table comments |
[DBAL-167] Schema comparator doesn't work properly with columnDefinition's Created: 17/Sep/11 Updated: 16/Jul/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Drivers, Platforms, Schema Managers |
| Affects Version/s: | 2.0.8, 2.1, 2.1.1, 2.1.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Dmitry Strygin | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | None | ||
| Description |
|
Schema comparator will mostly always return changed properties on columns for entities defined with columnDefinition even they are identical in the DB. This is due to weak low-lever compatibility of SchemaTool#getCreateSchemaSql() and SchemaTool#getSchemaFromMetadata() – the first one doesn't reconstruct columnDefinition, and the other one never supports 'fixed', 'default', cannot determine, whether it is boolean or integer (ex. TINYINT in the DB), etc... All this results in extremely annoying unnecessary alter-table-change-columns surrounded by dropping and after that re-enabling constrains dependent on those columns. I mean stuff like this: symfony2#app/console doctrine:schema:update --dump-sql ... ALTER TABLE es_hotels DROP FOREIGN KEY FK_527F88EE584598A3F92F3E70; ALTER TABLE es_hotels DROP FOREIGN KEY FK_527F88EE584598A37A3ABE5D; ALTER TABLE es_hotels DROP FOREIGN KEY FK_527F88EE584598A3EE551564; ALTER TABLE es_hotels CHANGE is_active is_active TINYINT(1) NOT NULL DEFAULT '1', CHANGE checksum checksum CHAR(32) DEFAULT NULL; ALTER TABLE es_hotels ADD CONSTRAINT FK_527F88EE584598A3F92F3E70 FOREIGN KEY (operator_id, country_id) REFERENCES es_countries(operator_id, id) ON DELETE CASCADE; ALTER TABLE es_hotels ADD CONSTRAINT FK_527F88EE584598A37A3ABE5D FOREIGN KEY (operator_id, resort_id) REFERENCES es_resorts(operator_id, id) ON DELETE CASCADE; ALTER TABLE es_hotels ADD CONSTRAINT FK_527F88EE584598A3EE551564 FOREIGN KEY (operator_id, subresort_id) REFERENCES es_subresorts(operator_id, id) ON DELETE CASCADE; ... The simple solution would be to fix schema comparator not to signal any changes on columns with columnDefinition properties. I can do this |
| Comments |
| Comment by Roderick Schaefer | We handle IT [ 16/Oct/11 ] |
|
I'm having the same issue on my production webserver, but not on the development webserver. I find that odd. It tries to drop all foreign keys and create them again, although without the CHANGE statement you are referring to, Dmitry. |
| Comment by Benjamin Eberlei [ 09/Jan/12 ] |
|
This maybe fixable by making a hash out of the column definition and saving it into a database comment. The Foreign Key problem maybe because of an old MySQL version 5.0.x |
| Comment by Joe Cai [ 16/Jul/12 ] |
|
@beberlei, sounds good to me. any plan of implementing this? |
[DBAL-411] Schema updater breaks when using backticks in tablenames. Created: 08/Jan/13 Updated: 08/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Endaco | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | schematool | ||
| Environment: |
Debian Linux 6.0, PHP 5.3.3, MySQL 5.1.63 |
||
| Description |
|
When using backticks around table-names (for example "`Order`"), the Doctrine schema update tool wants to recreate all foreign keys on every run. This error was introduced in commit cb3ec49cb4401bd1c8be6ba9671f651802586eaf |
[DBAL-406] PostgreSqlSchemaManager::tablesExist() misses schema-qualified table names if they exist in the first schema on the search path Created: 07/Jan/13 Updated: 07/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | 2.3.1 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Roger Hunwicks | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | postgresql | ||
| Environment: |
Postgresql 9.1 |
||
| Description |
|
Please see https://github.com/doctrine/migrations/issues/99 for additional background. To reproduce: CREATE SCHEMA test_schema; CREATE TABLE test_schema.test_table (test_column TEXT); Then in Doctrine: Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
$connection->executeUpdate('SET search_path=test_schema;');
$result = $connection->getSchemaManager()->tablesExist(array('test_schema.test_table'));
$result is false when it should be true. The error occurs because PostgreSqlSchemaManager returns the bare table name from getPortableTablesList() if the schema is the first one in the search path. The full explanation is... AbstractSchemaManager::tablesExist() calls $this->getPortableTablesList() before checking if the tables exist. PostgreSqlSchemaManager overrides this in _getPortableTableDefinition() by comparing the schema for the table with the search path for the connection. If the table schema is the first one in the search path, then it returns the bare table name, if it isn't then it returns the schema-qualified table name (i.e. schema.table). tablesExist() does an array_intersect to check that all the tables in the search array exist in the database. If one of the tables in the search array was schema-qualified but also in the first schema on the search path, then you end up checking: array_intersect(array('test_schema.test_table'), array('test_table')) which fails. One way to fix it would be to override tablesExist() in PostgreSqlSchemaManager so that it passes the search array through getPortableTableDefinition() before doing the array_intersect: Unable to find source-code formatter for language: php. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
/**
* Return true if all the given tables exist.
*
* @param array $tableNames
* @return bool
*/
public function tablesExist($tableNames)
{
foreach ($tableNames as $key => $tableName) {
if (strpos($tableName, '.') !== false) {
$tableName = explode('.', $tableName, 2);
$tableNames[$key] = $this->_getPortableTableDefinition(array('schema_name'=>$tableName[0], 'table_name'=>$tableName[1]));
}
}
return parent::tablesExist($tableNames);
}
I'm happy to provide a PR on GitHub if you want. |
[DBAL-400] can't add primary key to mysql table after the table is created Created: 20/Dec/12 Updated: 20/Dec/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms, Schema Managers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | John Robeson | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
A table in this application had no primary keys. I created an entity When i attempted to add this:
to this:
it generates SQL like this:
and says this:
|
[DBAL-7] Add support for char fields in the ORM layer Created: 24/Jan/10 Updated: 17/Sep/11 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Drivers, Platforms, Schema Managers |
| Affects Version/s: | 2.1, 2.1.1, 2.1.2 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor |
| Reporter: | Glen Ainscow | Assignee: | Roman S. Borschel |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
It's not possible to use char fields in the ORM layer. It should be possible to use something like: @Column(type="char") or ... |
| Comments |
| Comment by Roman S. Borschel [ 24/Jan/10 ] |
|
I dont think this is worth including in the main distribution. A char does not save much compared to a varchar (1 Byte?) and you already have 2 options to make a char:
IMHO, just use a string type with the length you want: @Column(type="string", length=2). That becomes a varchar with length 2. |
| Comment by Glen Ainscow [ 24/Jan/10 ] |
|
Ya, it is only 1 extra byte. I'm not sure what to do, I like things as optimized as possible, but I guess I could just use columnDefinition if necessary. |
| Comment by Glen Ainscow [ 24/Jan/10 ] |
|
Actually, I don't really see any reason not to include the char type. |
| Comment by Roman S. Borschel [ 24/Jan/10 ] |
|
How about code bloat? |
| Comment by Glen Ainscow [ 24/Jan/10 ] |
|
How many LoC? |
| Comment by Guilherme Blanco [ 25/Jan/10 ] |
|
@darkangel Around 40. And lots of conditionals, which decreases efficiency of algorithm. I vote for FixedString DBAL DataType. |
| Comment by Roman S. Borschel [ 25/Jan/10 ] |
|
We will not put every special data type someone comes up with in the core library. If we go this route, at the end we have 100+ data types (100+ classes plus a bloated type map) in the core library. There are at least 2 decent options of making a char already if you care about byte counting (see above). "Why not?" is not the question to ask for when it comes to new features. If it were, we would include a whole lot of stuff that is useless for 99% of the users. There must be strong arguments for "Why?" and there are none. If we get 50+ votes on this issue we can talk again. |
| Comment by Glen Ainscow [ 25/Jan/10 ] |
|
Of course not. I didn't know that char was a special data type (especially since it's supported in DC1.2). I will use @columnDefinition. You may close this issue. |
| Comment by Roman S. Borschel [ 25/Jan/10 ] |
|
No need to become defensive. There is still the chance that demand for this particular type gets very high and that can change things. Thats why this stays open. Otherwise the next guy would probably just create a duplicate ticket (not sure whether non-owners can reopen other tickets). |
| Comment by Benjamin Eberlei [ 25/Jan/10 ] |
|
@Glen The problem with Doctrine 1 and having lots of different data-types is that of maintainability. You have to ensure that all the types work on all supported platforms with each and every version. The more datatypes we support by default the more complex will it be for the Doctrine 2 Core to ensure compability and maintainability in this regard. For each new platform that we will support all datatypes have to be supported for example, something that might even become impossible for some databases. Adding a datatype from the user perspective is rather simple though, it has to be tested once and is only about 20-40 LOC. I bet you 100 bucks that soon there will be code-snippets out there on all the different database specific types as a doctrine 2 implemention. |
| Comment by Glen Ainscow [ 25/Jan/10 ] |
|
@Roman @Benamin Thanks. |
| Comment by Dmitry Strygin [ 17/Sep/11 ] |
|
Sorry for party rocking but i think that 'fixed' annotation should be enabled in ORM column definitions. |
[DBAL-373] Indexes and uniqueConstraints has been ignored Created: 26/Oct/12 Updated: 20/Apr/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Diego Oliveira | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 12.04 with MySQL 5.5 and PHP 5.4 |
||
| Attachments: |
|
| Description |
|
I using the Doctrine Migrations and when I declared my entity with the indexes section, the index name has been ignored. It's like this: indexes: but, the diff tools ignore it and give me this code: and it should be: Notice: I open the same bug on the migrations repository in github and @kimhemsoe told me to open here, since this is generated by DBAL component. |
| Comments |
| Comment by Padraig O'Sullivan [ 11/Dec/12 ] |
|
Did you specify an index name in the indexes property for your entity in your PHP file? In this case, you should have something like:
indexes={@Index(name="IDX_ADDRESS_CITY", columns={"city_id"})}
That should result in the correct SQL being generated. If I modify the above to:
indexes={@Index(columns={"city_id"})}
I also get a migration that has SQL with an auto-generated index name. |
| Comment by Diego Oliveira [ 02/Feb/13 ] |
|
Yes I did specify a name, as you can see: uniqueConstraints:
UNIQUE_STATE_SLUG:
columns: slug
indexes:
IDX_USER_ADDRESS:
columns: address_id
I don't try do to it using annotations because I choose do use yaml to describe my entities. I will take a look on the source code to see if I can fix it and send a PR. |
| Comment by Diego Oliveira [ 02/Apr/13 ] |
|
I already sent this patch to Guilherme Blanco, but I guess he doesn't have time to take a look on it. I guess my solution it's not ideal, but it solve the problem and can be a base to make a better solution. |
| Comment by Benjamin Eberlei [ 20/Apr/13 ] |
|
Diego Oliveira the fix doesn't seem too nice with the additional boolean flag. I would rather like to fix the root cause instead of adding this solution. |
| Comment by Benjamin Eberlei [ 20/Apr/13 ] |
|
The issue is tricky, because we cannot just move the index definitions above, they will need the columns, however that directly generates the index in the schema tool. Maybe if the gather join column methods would check if they can add an index already it would work. |
[DBAL-352] Running doctrine:schema:update throws an exception the first time, succeeds the second time. Created: 25/Sep/12 Updated: 25/Sep/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Schema Managers |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Mark A. Hershberger | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Shell output from my symfony project: [Doctrine\DBAL\DBALException] SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'account' doesn't exist in table [PDOException] doctrine:schema:update [--complete] [--dump-sql] [--force] [--em[="..."]] $ app/console doctrine:schema:update --force |
| Comments |
| Comment by Christophe Coevoet [ 25/Sep/12 ] |
|
Please run the command with the --dump-sql option instead of --force each time before launching it for real, to be able to see which SQL queries are executed in both cases |
| Comment by Mark A. Hershberger [ 25/Sep/12 ] |
|
I'm not sure how to roll back the changes so that I can reproduce this. |
| Comment by Mark A. Hershberger [ 25/Sep/12 ] |
|
Got it after a little poking around with git. Rolling back to a commit in my code before the one given here didn't didn't show this reproduce this. $ php app/console doctrine:schema:create Creating database schema... $ git checkout d686a39fb664dca540167e1b3e96ea0ffd67bc00 $ php app/console doctrine:schema:update --dump-sql [Doctrine\DBAL\DBALException] SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'account' doesn't exist in table [PDOException] doctrine:schema:update [--complete] [--dump-sql] [--force] [--em[="..."]] $ php app/console doctrine:schema:update --dump-sql $ php app/console doctrine:schema:update --force $ |
| Comment by Christophe Coevoet [ 25/Sep/12 ] |
|
hmm, the first update seems to miss the addition of the account field, which is done the second time through ALTER TABLE Tn ADD account INT DEFAULT NULL; |