Comments (11)
why do you want to avoid detecting column renames?
We (Contao) use the doctrine schema manager to update the database schema after updates or after installing an extension. In this case the user can not alter the result of the comparator (like it would be possible using doctrine migrations) so if an incorrect rename was detected there would be no way to intervene. (Most users would probably also not recognise the wrong rename). We had many issues with this in the past (see also #3661) but we since used the workaround as outlined in #6299 (comment) and this worked flawlessly ever since.
And would the problem you have disappear with #6280 ?
No, as the rename detection is still in place and there is no option to disable it.
But I think #6280 is a very good feature as it makes intentional renames possible π
from dbal.
Is there a better way to do this? I basically just want to disable
Comparator::detectRenamedColumns()
so that it never detects a rename of a column.
We could make that configurable. Detecting renames is fuzzy, so the requirement to disable that feature seems reasonable to me. Up for a PR?
from dbal.
Yes. However, we could think about backporting the API to 3.x if that makes the upgrade from 3.x to 4.x easier. But let's target 4.1.x first.
from dbal.
β¦ I'm thinking of an alternative, which would be to tag dropped columns, when doing
dropColumn
, as excluded from detection with a flag on Column β¦
The problem is we never do a manual dropColumn
. We simply compare the live schema with the desired one like $comparator->compareSchemas($schemaManager->introspectSchema(), $schemaTool->getSchemaFromMetadata(β¦))
and need to make sure this never results in any renames.
(in our case, intentional renames would be done βmanuallyβ before the schema update)
from dbal.
Up for a PR?
Sure. That would be for version 4.1.0 I guess, right?
from dbal.
Done: #6300
from dbal.
@ausi why do you want to avoid detecting column renames? And would the problem you have disappear with #6280 ?
from dbal.
My PR does not remove the rename detection even if an explicit renaming has been provided (maybe it should?) but if a column is explicitly renamed then those 2 particular columns shouldn't be taken into account during the detection
from dbal.
Since the detection is made from dropped columns and added columns of the same type, I'm thinking of an alternative, which would be to tag dropped columns, when doing dropColumn
, as excluded from detection with a flag on Column (which already has a list of options available)
from dbal.
You could still iterate over the tables and columns in the old schema to set the flag
Or an in between, we add a configuration in the SchemaConfig of Table so the iteration is only on the tables
Otherwise I don't have anything against the comparator config but I do think it should indeed be as a state to limit the signature changes, the comparator class is not final and only the constructor is internal, so it's still allowed to be extended it seems which means a signature change of public or protected methods would indeed be a breaking change
from dbal.
Up for a PR?
Done: #6300
Addressed all review comments there, so this should be ready. π
from dbal.
Related Issues (20)
- Nested transactions without enable Savepoints. HOT 13
- Invalid mysql is produced in MySQLSchemaManager::selectTableColumns HOT 3
- DBAL 4 MySQL COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'" at HOT 4
- Reserved word Condition is not escaped on insert
- Doctrine\DBAL\Driver\PDO\SQLSrv\Statement::bindParam is deprecated HOT 3
- Support "ON UPDATE CURRENT_TIMESTAMP" for MySQL
- SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'TABLE_NAME' i n where clause is ambiguous HOT 2
- Password authentication failed DBAL v4 and ORM v3 HOT 4
- Impossible to create a user HOT 2
- Partial unique index for XML mapping is not supported? HOT 4
- Column precision is not specified
- Support DuckDB HOT 1
- [API] Add getWrappedDriver method to AbstractDriverMiddleware HOT 2
- Doctrine\ORM\QueryBuilder::setParameter and ArrayParameterType in 4.0.0 HOT 2
- `SqliteSchemaManager` still emulates schema namespacing
- Custom driver and ExceptionConverter HOT 2
- PostgreSQL option gssencmode=disable isn't configurable HOT 4
- index-by and order-by do not work for abstract entities with inheritance type "JOINED" in many-to-many relations HOT 3
- Got error on SQLite database creation stage HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbal.