[DBAL-122] Impossible to save data to image/binary/varbinary Created: 16/May/11 Updated: 22/Feb/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.0.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Martin Weise | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
XAMP, MsSQL-Server 2008, PHP 5.3.x, MS pdo_sqlsrv_vc6_ts.dll |
||
| Description |
|
When trying to insert a value into a Column with type 'image', 'binary' or 'varbinary' the SQLServer states that this is not possible. When trying to insert into 'image' the error message is: Doctrine prepares the image/binary/varbinary column in the statements as nvarchar(max) which is wrong. The cause of this error is that in the MsSQLPlatform::getVarcharTypeDeclarationSQLSnippet($length, $fixed), The documentation for the MsSQLServer states following conversions (http://207.46.16.252/de-de/library/ms187928.aspx): *char => binary/varbinary : Explicit conversion So the solution would be, either to leave the datatype blank or use the char/varchar datatype when saving into image/binary/varbinary, which would cause an extra datatype as those would collide with 'text' I guess. |
| Comments |
| Comment by Benjamin Eberlei [ 09/Jan/12 ] |
|
I get the problem, but i don't understand the solutions Can you explain a bit more? 1. how do i leave a datatype empty? and which one? I think this is just a problem of unspecific descriptions |
| Comment by Martin Weise [ 22/Feb/12 ] |
|
Hi Benjamin Sorry, for this long delay. declare @p1 int
set @p1=NULL
exec sp_prepexec @p1 output,
N'@P1 nvarchar(36),@P2 nvarchar(max),@P3 nvarchar(34)',
N'INSERT INTO mc_dokument_data (id, data, mc_dokument_id) VALUES (@P1, @P2, @P3)',
N'03DDAAD1-4BFA-416B-A0C0-9B8B7148F31C',
N'0x3c3f786d6c20766572736...',
N'mwe3bc2c0da6543d1f48d7c83e64f5c449'
select @p1
But it has to be ( removed '-quotes and @P2 changed to varbinary(MAX) ): declare @p1 int
set @p1=NULL
exec sp_prepexec @p1 output,
N'@P1 nvarchar(36),@P2 varbinary(max),@P3 nvarchar(34)',
N'INSERT INTO mc_dokument_data (id, data, mc_dokument_id) VALUES (@P1, @P2, @P3)',
N'03DDAAD1-4BFA-416B-A0C0-9B8B7148F31C',
0x3c3f786d6c20766572736...,
N'mwe3bc2c0da6543d1f48d7c83e64f5c449'
select @p1
I am not really sure any more if this is caused from Doctrine or from the 'MS SQL-Server PHP-PDO-Driver 2.0.1' . The funny thing is if I do this via executeQuery it works... $data = unpack("H*" , __some__data__); $data = '0x'.$data[1]; $em->executeQuery( "INSERT INTO mc_dokument_data (id, mc_dokument_id, data)". "VALUES('".$id."' , '" . $documentId . "', " . $data . " )" ); Hopefully I could clarify my problem. Regards |
[DBAL-109] Doctrine/DBAL/Platforms/MySqlPlatform.php is missing test coverage around _getCreateTableSQL method Created: 12/Apr/11 Updated: 18/Nov/11 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.1 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Wil Moore III | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
2.1.0-DEV |
||
| Description |
|
In "Doctrine/DBAL/Platforms/MySqlPlatform.php", the following methods are public: getShowDatabasesSQL, getCreateDatabaseSQL, getDropDatabaseSQL, getDropTableSQL (easy to test); however, the "_getCreateTableSQL" method is not public. Is there a specific reason for this difference? As a result of this method not being tested, there is a "quote" method being called which doesn't exist. See: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php#L410 The only way at this time to test for this case is to get an error when doing: $table->addOption('comment', '...'); I would suggest making the protected method public so it can be tested. I also suggest moving the options parsing out of _getCreateTableSQL into a helper method...this method seems a bit overloaded. If agreed, I'm happy to take care of the cleanup. Just wanted to get some feedback on the ideas first. |
| Comments |
| Comment by Benjamin Eberlei [ 18/Nov/11 ] |
|
This is an improvement |
[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-139] Oracle's sequences with NOCACHE Created: 29/Jul/11 Updated: 08/Nov/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.0.6 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Augusto Ximenes de Souza | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
Hi community, Today I tried to generate Oracle's sequences with "NOCACHE", but I checked that method "getCreateSequenceSQL" don't accept. Can we improvement this method to allow? Below an example of the sintaxe: CREATE SEQUENCE seq_test START WITH 1 INCREMENT BY 1 NOCACHE |
| Comments |
| Comment by Ivan Andric [ 22/Sep/12 ] |
|
Hi, If cache value is specified then syntax should contain CACHE keyword that follows the value and if value is not specified then it should go without CACHE keyword. My Idea is to add cache attribute to Sequence object and then under the previous story, set cache to given value if value is greater than 1 and less than calculation by the given formula. For nocache, Some public function will return NOCACHE or CACHE n and that function could be called in getCreateSequenceSQL method from Sequence input parameter. Anyone have a better idea or I can code this and request pull from my fork? |
| Comment by Ramon Henrique Ornelas [ 08/Nov/12 ] |
|
Duplicate issue http://www.doctrine-project.org/jira/browse/DBAL-348 Greetings |
[DBAL-357] Missing way to set types for CAST declaration Created: 04/Oct/12 Updated: 04/Oct/12 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.2, 2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Improvement | Priority: | Major |
| Reporter: | Pete Sisson | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
For a query such as x = CASE WHEN id=$1 THEN CAST($2 AS int) there doesn't seem to be a way to correctly assign the type across multiple platforms. E.g. Postgres required "int" but mysql just requires "unsigned". Attempting to use "int" here with mysql will fail. The method Doctrine\DBAL\Platforms method getIntegerTypeDeclarationSQL will return something like "INT unsigned" for sql, which also fails. |
[DBAL-289] Wrong diff between Oracle 'Date' type and Metadata 'Date' type Created: 30/May/12 Updated: 22/Aug/12 |
|
| Status: | Reopened |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Christian Stoller | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Oracle Express 11g and doctrine-dbal 2.2.2 |
||
| Description |
|
Hi,
--dump-sql says: ALTER TABLE CONSIGNMENTS MODIFY (SDGDATE DATE DEFAULT NULL); The current table structure looks like that:
Mapping definition: /** * @ORM\Column(name="SDGDATE",type="date",nullable=true) */ private $sdgdate; I think there is a problem with the comparison between Oracles 'Date' type and the Metadata 'Date' type. I am used to use MySQL as DBMS but our customer uses Oracle. MySQL's 'datetime' and Oracle's 'date' type are store the same data. I am not sure what should be done here. Because this could lead to confusion for all Oracle user. Maybe there could be a request to the platform in the Schema Comparator here: public function diffColumn(Column $column1, Column $column2) { $changedProperties = array(); if ( $column1->getType() != $column2->getType() ) { $changedProperties[] = 'type'; } // ... } |
| Comments |
| Comment by Christian Stoller [ 30/May/12 ] |
|
When I put a breakpoint on the second line of the diffColumn method in my IDE and stop there during debugging I have those variable values: $this Doctrine\DBAL\Schema\Comparator $changedProperties array[0] $column1 Doctrine\DBAL\Schema\Column _type Doctrine\DBAL\Types\DateTimeType <-- datetime _precision integer 10 _scale integer 0 _unsigned boolean 0 _fixed boolean 0 _notnull boolean 0 _autoincrement boolean 0 _platformOptions array[0] _comment string "" _customSchemaOptions array[0] _name string "SDGDATE" _quoted boolean 0 $column2 Doctrine\DBAL\Schema\Column _type Doctrine\DBAL\Types\DateType <-- date _precision integer 0 _scale integer 0 _unsigned boolean 0 _fixed boolean 0 _notnull boolean 0 _autoincrement boolean 0 _platformOptions array[1] _customSchemaOptions array[0] _name string "SDGDATE" _quoted boolean 0 You see that there are different types. But it would be nice if the comparison would say: "Theay are equal - no diff" |
| Comment by Benjamin Eberlei [ 08/Jul/12 ] |
|
This issue can't be fixed. Doctrine has this type abstraction here which prevents a special case fix here. The solution in this case is obvious, set the type to "datetime" on Oracle. |
| Comment by Christian Stoller [ 22/Aug/12 ] |
|
Sorry, this issue commes up again.
Shipment:
type: entity
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
pickupDate:
type: date
column: pickup_date
pickupTimeFrom:
type: time
column: pickup_time_from
lifecycleCallbacks: { }
When I update my schema with the above YAML mapping, I always get the following error although I haven't changed anything at the mapping.
Okay, I could change the types to 'datetime', but what if I have to move to MySQL? I just want to store 'date' and 'time', not 'datetime'. |
[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-444] OraclePlatform getSequenceNextValSQL not handling case/quoting properly on 11g Created: 10/Feb/13 Updated: 04/Apr/13 |
|
| Status: | In Progress |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | 2.4 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Max Milaney | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | oci8, oracle, sequence | ||
| Environment: |
PHP version 5.4.11 |
||
| Attachments: |
|
| Description |
|
I have an installer script that uses ORM SchemaTool to create the entities in the DB and then populates with basic data using basic EM->persist calls via ORM. Sequence objects are created, and when using the 10g Instant Client everything worked correctly, however, upon upgrade to latest version of the Instant Client Oracle seems to be expecting consistent case for these schema objects. It appears as if they are being created with a quoted name as they are created in lowercase. OraclePlatform::getSequenceNextValSQL, however, generates "SELECT entity_id_seq.nextval FROM DUAL" and this fails with error "General error: 2289 OCIStmtExecute: ORA-02289: sequence does not exist". Executing "SELECT "entity_id_seq".nextval FROM DUAL" directly on the DB returns the correct value. I believe this may also impact the code in http://www.doctrine-project.org/jira/browse/DBAL-278 |
| Comments |
| Comment by Max Milaney [ 10/Mar/13 ] |
|
Hi there, |
| Comment by Benjamin Eberlei [ 14/Mar/13 ] |
|
Can you maybe show an entity definition with its sequence mapping? |
| Comment by Max Milaney [ 17/Mar/13 ] |
|
Here you are mate. Please see attachment. |
| Comment by Benjamin Eberlei [ 04/Apr/13 ] |
|
I cant seem to find the problem, in DBAL "lib/Doctrine/DBAL/Platforms/OraclePlatform.php" on line 171, the sequence statement is created with $sequence->getQuotedName($platform), but this only works if quoting is requrested for the sequence. How do you actually create the sequence? Your entity doesnt have @GeneratedValue. What does the create schema command say with "--dump-sql" flag? Is the SQL quoted? |
[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-264] Support for UIDs in PostgreSQL Created: 30/Apr/12 Updated: 29/Apr/13 |
|
| Status: | Awaiting Feedback |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | New Feature | Priority: | Major |
| Reporter: | ross neacoders | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Please add support for uuid datatype in PostgreSQL |
| Comments |
| Comment by Darrell Hamilton [ 12/Oct/12 ] |
|
It seems the only missing piece is the implementation of the getGuidExpression method in the PostgreSqlPlatform class. Details on generating UUIDs from postgres can be found here: http://www.postgresql.org/docs/current/static/uuid-ossp.html Things that would need to be addressed: 1) It requires the uuid-ossp module to be installed in the database. Solve with documentation or ...? 2) There isn't just one function. Just pick one or make it configurable with a sane default? |
| Comment by Ross Cousens [ 10/Dec/12 ] |
|
I have implemented this for my own project, using what I think is a sane default: public function getGuidExpression() { return 'uuid_generate_v4()'; }The other issue I think that needs addressing is that the extension must be loaded into the current database upon creation. Either this is a deal-breaker right here (relying on a PGSQL plugin that's not available by default) OR If not, maybe schema:update/create needs to check for whether postgresql is being used, whether there is a guid type/generator being used in an entity, and then either execute CREATE EXTENSION uuid-ossp;, and failing that return an exception that informs the user that uuid-ossp must be available as an extension before GUID generation can be used in entities. Can someone explain to me please the position on this currently? Is it not ok to rely on non-core/standard functionality? |
| Comment by Mark Badolato [ 25/Apr/13 ] |
|
Is there any sort of decision on this item? I was trying to use UUID with Postgres and finally got it to work by adding public function getGuidExpression() { return 'UUID_GENERATE_V4()'; }and went to submit a patch, then found this ticket and see that it's the exact same solution that Ross Cousens submitted above. I'd really like to not maintain my own fork of the repository just to have this change in place, and it seems like a reasonable fix (barring the uuid-ossp extension not being a Postgres default extension). Can we get this in there so it's available, and worry about the issue of informing the user about the extension at a later point? Or is there an easy way that anyone knows that I can add the function to my own class (in a Symfony2 project) that would extend PostgreSqlPlatform.php and add the function, without the need for me to fork Doctrine and add it on my own? Thanks, |
| Comment by Mark Badolato [ 25/Apr/13 ] |
|
Pull request submitted |
| Comment by Ross Cousens [ 26/Apr/13 ] |
|
I hope this gets accepted but I fear it won't. The original complaint against implementing GUID for the PostgreSQL platform driver was because a) it required a separate extension to be enabled on the server itself b) and there were a number of GUID generation functions available. To use anything but v4 would be asinine unless some external constraint was forcing you to use the older generation algorithms, so I think argument b is mostly moot. Argument a can easily be solved with documentation, programmatically as well (would require more work) or just left as is because the error back from postgresql is very verbose. Cannot find function uuid_generate_v4. Google it, see that extension is required, see that it's available in PostgreSQL contrib packages, enable it, and voila it works. |
| Comment by Mark Badolato [ 26/Apr/13 ] |
|
Agreed, and I think that having SOMETHING that is usable (and has a very clear message that you need to install an extension) is better than nothing. The implementation can be expanded later to cover the extension not existing, or using something other than v4, etc. But this should be good enough for most people and it seems silly not to have, or at least not have a way to override and provide it. I was looking at the Symfony configs to see if there was a way to define my own platform class that could then just extend the current PostgreSqlPlatform class and add a the function, but that doesn't seem to be doable (or I just missed it) |
| Comment by Mark Badolato [ 27/Apr/13 ] |
|
I just saw that this got merged into master. As soon as this hits 2.3* I can do away with the manual UUID generation for id's that we're currently doing Thanks much Benjamin! |
| Comment by Ross Cousens [ 29/Apr/13 ] |
|
Yay, I am happy that this has been accepted and will make it through to next release. Thank you Mark/Benjamin! |
[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-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-293] mysql platform can not choose text type column Created: 20/Jun/12 Updated: 08/Sep/12 |
|
| Status: | In Progress |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Kiichi Kajiura | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
getVarcharMaxLength() in DBAL/Platforms/MySqlPlatform.php returns 65535; |
| Comments |
| Comment by Benjamin Eberlei [ 05/Jul/12 ] |
|
How do you call the schema/platform code? The code is correct, i think you are using it wrong. |
| Comment by Kiichi Kajiura [ 19/Jul/12 ] |
|
I don't use it directly. |
[DBAL-422] Wrong VARCHAR default length in SQLServerPlatform Created: 24/Jan/13 Updated: 24/Jan/13 |
|
| Status: | Open |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.3.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Steve Müller | Assignee: | Benjamin Eberlei |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | platform, sqlserver, sqlsrv, varchar | ||
| Description |
|
In SQLServerPlatform the default length for a VARCHAR declaration is set to "255". But according to the SQLServer documentation from Microsoft the default length is "1", if omitted in the declaration. I don't exactly know if the current implementation is intended, otherwise it should be fixed. I would then create an PR if desired. |
[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. |