Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for alter table, foreign keys and autoincrement detection to Sqlite platform and schema #220

Merged
merged 9 commits into from
Dec 23, 2012

Conversation

hason
Copy link
Contributor

@hason hason commented Oct 20, 2012

No description provided.

@doctrinebot
Copy link

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DBAL-370

}
}

return $list;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong indentation (using tabs ?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@lsmith77
Copy link
Member

would be great if you could also add support for deferred/deferrable as per lsmith77@bb54ca0#commitcomment-2158125

furthermore that patch also tries to make the support for foreign keys dynamic to handle the case of old sqlite versions and sqlite versions where FKs are disabled. not sure if that is necessary

@lsmith77
Copy link
Member

there are also some tests you might then also want to add to this PR once you add support for deferred/deferrable #228

@beberlei
Copy link
Member

The pull request is not mergable anymore, can you rebase onto master?

@hason
Copy link
Contributor Author

hason commented Nov 18, 2012

@lsmith77 Support for deferred/deferrable foreign keys is done (added also sql parsing).
@beberlei Rebased

@@ -498,6 +520,60 @@ protected function getReservedKeywordsClass()
/**
* {@inheritDoc}
*/
protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
{
if (!$diff->fromTable instanceof Table) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing spaces

$query[] = 'CREATE TABLE ' . $name . ' (' . $queryFields . ')';

if (isset($options['alter']) && true === $options['alter']) {
return $query;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct? It seems if you return here you're not considering the indexes created for this table anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The indexes are created in getPostAlterTableIndexForeignKeySQL method. We want to create indexes on renamed table (not on __temp__<name>).

{
if ( ! $table instanceof Table) {
$tableDetails = $this->tryMethod('listTableDetails', $table);
if (false === $table) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo false === $tableDetails

beberlei added a commit that referenced this pull request Dec 23, 2012
[WIP] Added support for alter table, foreign keys and autoincrement detection to Sqlite platform and schema
@beberlei beberlei merged commit 63b7ef1 into doctrine:master Dec 23, 2012
@Ocramius
Copy link
Member

Ocramius commented Jan 2, 2013

@hason is it just me or will the current implementation simply fail on anything that implies creation of a foreign key? This PR currently breaks all my functional test suites that generate a schema (ORM-side) in memory SQLite because of getCreateForeignKeySQL.

{
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted. After all, this PR doesn't really add support for it right now

@zorang
Copy link

zorang commented Apr 9, 2013

New doctrine 2.3.3 version is available, and I waited a lot for that because i hoped that when create SQLite schema that FK-s will be created also! But not! FK-s are still not generated! Can anyone tell me why?! I know that it was implemented last year (2012) in some branch... What happened?! Its removed or what?! Its not supported in new 2.3.3 doctrine?!?!

Zoran

@flip111
Copy link
Contributor

flip111 commented Sep 13, 2013

@morozov morozov changed the title [WIP] Added support for alter table, foreign keys and autoincrement detection to Sqlite platform and schema Added support for alter table, foreign keys and autoincrement detection to Sqlite platform and schema Aug 27, 2022
morozov added a commit to morozov/dbal that referenced this pull request Aug 27, 2022
The $oldColumnName property and the corresponding constructor parameter
were relevant until doctrine#220 (2.4.0)
which introduced the $fromColumn property and the corresponding
constructor parameter. Now they are redundant.

The same applies to getOldColumnName(). The $fromColumn property
contains all the properties of the old column including the name.
@morozov morozov mentioned this pull request Aug 27, 2022
morozov added a commit to morozov/dbal that referenced this pull request Aug 27, 2022
The $oldColumnName property and the corresponding constructor parameter
were relevant until doctrine#220 (2.4.0)
which introduced the $fromColumn property and the corresponding
constructor parameter. Now they are redundant.

The same applies to getOldColumnName(). The $fromColumn property
contains all the properties of the old column including the name.
morozov added a commit to morozov/dbal that referenced this pull request Aug 27, 2022
The $oldColumnName property and the corresponding constructor parameter
were relevant until doctrine#220 (2.4.0)
which introduced the $fromColumn property and the corresponding
constructor parameter. Now they are redundant.

The same applies to getOldColumnName(). The $fromColumn property
contains all the properties of the old column including the name.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants