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

Propel repeatedly generating the same migrations in subsequent diffs. #1031

Closed
williamlang opened this issue Nov 9, 2015 · 9 comments
Closed
Labels

Comments

@williamlang
Copy link

Propel is repeatedly generating the same diff over and over regardless of whether or not I run the migration.

The columns appear to always be integers.

They're all non nullable columns.

Some are auto increment.

Here's a model that is generating the diff, despite not being different:

<table name="viz_pages" phpName="VizPage">
    <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
    <column name="viz_id" type="integer" required="true" size="11" />
    <column name="page" type="varchar" size="255" required="true" />

    <foreign-key foreignTable="vizzes">
        <reference local="viz_id" foreign="id" />
    </foreign-key>

    <behavior name="timestampable" />
</table>

The SQL Create Table statement (generated from MySQL workbench)

CREATE TABLE `viz_pages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `viz_id` int(11) NOT NULL,
  `page` varchar(255) NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `viz_pages_fi_f3cf89` (`viz_id`),
  CONSTRAINT `viz_pages_fk_f3cf89` FOREIGN KEY (`viz_id`) REFERENCES `vizzes` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

Just as a side note, the bug doesn't prevent me from doing any work -- it just adds unnecessary queries (that do nothing in the end) to my migrations.

The query that gets generated in the migration is:

ALTER TABLE `viz_pages`

  CHANGE `viz_id` `viz_id` INTEGER(11) NOT NULL;
@SourceCode
Copy link

I am also experiencing the same issue.

I am always getting this inserted into my migrations:

ALTER TABLE table_name

CHANGE note note TEXT(255) NOT NULL;

The field is longvarchar in the schema and live database..

@marcj
Copy link
Member

marcj commented Nov 9, 2015

Which version do you use? Is this also the case for current 2.0.0-alpha5 (not master) version?

@williamlang
Copy link
Author

For me, this happened in both dev-master and 2.0.0-alpha5

composer.lock for 2.0.0-alpha5

{
        "name": "propel/propel",
        "version": "2.0.0-alpha5",
        "source": {
            "type": "git",
            "url": "https://github.com/propelorm/Propel2.git",
            "reference": "75f775cf6de41595d1240885eea5fa5d475d228d"
        },

composer.lock for dev-master

    {
        "name": "propel/propel",
        "version": "dev-master",
        "source": {
            "type": "git",
            "url": "https://github.com/propelorm/Propel2.git",
            "reference": "27bb4ec5dbe608ed9e8ff3f2f99c2ef43f03cc06"
        },

@marcj
Copy link
Member

marcj commented Nov 9, 2015

You could remove size="11" of the int column since this should be the default value.

@marcj
Copy link
Member

marcj commented Nov 9, 2015

@SourceCode please shouw us your schema.xml. Guess you have specified a size for a TEXT column, which isn't necessary.

@SourceCode
Copy link

Marc -
Thank you - you were indeed correct - a length had been declared on that field which as you noted, is not needed. I've updated this which resolved the issue. I was on dev-master.

@williamlang
Copy link
Author

Removing the size property fixed the issue.

Still a small bug.

@dereuromark dereuromark added the Bug label Jul 1, 2020
@dereuromark
Copy link
Contributor

Is this still relevant or can it be closed?

@williamlang
Copy link
Author

Can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants