Skip to content

Conversation

@sarunast
Copy link

Dumping table with MySQL gave my duplicate Primary Keys so I changed the generation.
Also there was no Index generation so I managed to create function which can do that.

Add index generation and change PK generation
@luislobo
Copy link

THanks! I noticed it but handled it on the generated script by hand

Copy link
Owner

Choose a reason for hiding this comment

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

Why should this be optional?

Copy link
Author

Choose a reason for hiding this comment

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

I don't use SQLite so decided to disable it. Just makes migration cleaner.

Copy link
Owner

Choose a reason for hiding this comment

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

Could you set the default to false so we don't break existing commands.

Copy link
Owner

Choose a reason for hiding this comment

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

Does this still work for SQLite?

Copy link
Author

Choose a reason for hiding this comment

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

I don't know about SQLite sorry.

@schmunk42
Copy link
Owner

Is there anything which would break backward compatibility or SQLite support? I left a comment at the code line.

Copy link
Owner

Choose a reason for hiding this comment

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

This if should be moved to line 301. I got a sytnax error unexpected endif when I ran a test.
Could you also verify the changeset by dumping a rather complex MySQL schema and then insert it into SQLite?

@schmunk42
Copy link
Owner

Got an error when dumping a table without PK, eg. AuthAssignment

*** applying m130715_184724_dump

    > create table AuthAssignment ...Exception: CDbCommand failed to execute the SQL statement: CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1 near ")": syntax error. The SQL statement executed was: CREATE TABLE 'AuthAssignment' (
    "itemname" varchar(64) NOT NULL,
    "userid" varchar(64) NOT NULL,
    "bizrule" text,
    "data" text,
    PRIMARY KEY ()
)  

Shouldn't output the last line I think.

@sarunast
Copy link
Author

schmunk42 feel free to update however you want it, I don't mind. Here is the rep https://github.com/Stamy/database-command. It does completely everything for MySQL, Full FK generation, multiple-keys.

@schmunk42
Copy link
Owner

I'll have a detailed look, when I find more time. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants