schmunk42 / database-command Goto Github PK
View Code? Open in Web Editor NEWYii command to create database migrations from existing schema
Yii command to create database migrations from existing schema
The problem always occurs when importing table with a foreign key
: Syntax error or access violation: 1068 Multiple primary key defined.
regards,
bw
continued from #17 (comment)
Running command without any parameters (i.e. yiic edatabase) does display help, but also throws Error: Unknown action: index error. You may want to mute that somehow.
Hi,
Looks like this is somewhat MySQL-centric currently, for example the generated PKs have AUTO_INCREMENT in them, which doesn't work on PG.
Has anyone modified this to work with PostgreSQL yet, and have anything to share?
during dump
When the primary key is composed of two columns, the command generation is also incorrect:
CREATE TABLE IF NOT EXISTS `alert_listener` (
`alert_listener_id` int(11) NOT NULL AUTO_INCREMENT,
`listener` varchar(250) DEFAULT NULL COMMENT 'Describes the listner (email address, phone number, ...).',
`listener_type` int(11) DEFAULT NULL,
`is_active` tinyint(1) DEFAULT NULL,
`entity_alert_id` int(11) NOT NULL,
PRIMARY KEY (`alert_listener_id`,`entity_alert_id`),
KEY `fk_alert_listener_device_alert1` (`entity_alert_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=815 ;
gives
$this->createTable(AlertListener::model()->tableName(),
array(
"alert_listener_id"=>"pk",
"listener"=>"varchar(250)",
"listener_type"=>"int(11)",
"is_active"=>"tinyint(1)",
"entity_alert_id"=>"int(11) NOT NULL",
"PRIMARY KEY (entity_alert_id)"
),
$options);
A small suggestion for the generator: I prefer to get the table name form the Model, like this:
$this->createTable(ActionHistory::model()->tableName()
from http://www.yiiframework.com/extension/database-command/#c11253
There's an inconsistency between what you write in docs (README.md) and what you actually have in latest version of your code (tested on version 0.8.12 released on 11 Apr 2014):
yiic database
command, while it actually is yiic edatabase
due to naming scheme you used in your code. One must rename EDatabaseCommand
class to DatabaseCommand
to fix this or use yiic edatabase
command instead.yiic edatabase
) does display help, but also throws Error: Unknown action: index
error. You may want to mute that somehow.For people, who are using yiic commands for the first time, it would be a great addition to extend installation part of your doc as well. Two-line paragraph mentioning, that contents of zip file should be placed in protected/commands
(which must be created, if does not exist) and that it must be placed without folder structure (just, as is, including views
folder), which is contrary to extensions for example, which can be placed in subfolders, etc. That would help a lot to newbies, like me.
Aside above, thank you very much for a wonderful extension, which saves hours of coding!
dumping with
--prefix=news
also dumps "newsCategory" or "newsSomething"
would be great to get those other tables dumped only when using a wildcard
--prefix=news >>> dumps "news"
--prefix=news* >>> dumps "news", "newsCategory", "newsSomething"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.