0
Started

How to generate SQL Script from PHPMyAdmin for Reverse Engineering?

ian 1 year ago updated by Eugene 1 year ago 4

Hi 

I am trying to import the structure/schema  of an existng database - I have access via PHPMyAdmin  and have been trying to generate the SQL from there - the tables import ok but the primary keys do not import:

ALTER TABLE `XCategories`
ADD PRIMARY KEY (`XCategoryID`),
ADD KEY `fk_xcategories_xCountries` (`XCountriesID`);

Am I doing something wrong?

Answer

Answer

Dear Ian,

There are many ways how you can generate DDL script. 

Unfortunately Alter table xxx ADD PRIMARY KEY ... is not working for now in SqlDBM.

I'll convert this ticket to Bug and we will try to resolve it soon.


Here is couple examples how it can work:


CREATE TABLE `Customer01`
(
`CustomerId` int NOT NULL,
`Phone` varchar(20) ,
PRIMARY KEY (`CustomerId`)
) ;


CREATE TABLE `Customer02`
(
`CustomerId` int NOT NULL PRIMARY KEY ,
`Phone` varchar(20)
) ;


Searching answer

Dear User,

  We are not aware on what kind of user interface PhpMyAdmin provide to access Sql Structure.

Here is what I found after quick investigation:

https://superuser.com/questions/168595/how-to-export-mysql-schema-from-phpmyadmin

Hope this helps.

Please feel free to contact us in case you have any further questions.

Thanks,

Team - SqlDBM

Answer

Dear Ian,

There are many ways how you can generate DDL script. 

Unfortunately Alter table xxx ADD PRIMARY KEY ... is not working for now in SqlDBM.

I'll convert this ticket to Bug and we will try to resolve it soon.


Here is couple examples how it can work:


CREATE TABLE `Customer01`
(
`CustomerId` int NOT NULL,
`Phone` varchar(20) ,
PRIMARY KEY (`CustomerId`)
) ;


CREATE TABLE `Customer02`
(
`CustomerId` int NOT NULL PRIMARY KEY ,
`Phone` varchar(20)
) ;


Started

"Alter Table Add PK" script should be parsed properly now for MySQL.

Soon we will add support for "Alter Table Add FK" script