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

Default values in model #11

Open
NathanHazout opened this issue Feb 10, 2013 · 1 comment
Open

Default values in model #11

NathanHazout opened this issue Feb 10, 2013 · 1 comment
Assignees

Comments

@NathanHazout
Copy link

What steps will reproduce the problem?

  1. In MySQL, create a table with one or more columns of type TINYINT(1) (intended for boolean), NOT NULL, and set a default value
  2. Use Giix to generate a model

What is the expected output?
The model should have a rule that sets those fields to their respective default values if empty.

What do you see instead?
A rule that sets them to NULL if empty.

What version of giix are you using?
1.9.1

What is your stack (operating system, web server, DBMS, PHP version)? MacOS, Apache2, MySQL 5.1.53, PHP 5.3.6
What version of the Yii Framework are you using? 1.1.9

Please attach your relevant source and configuration files and sql scripts.

CREATE TABLE `community_user` (
  `community_id` varchar(50) NOT NULL COMMENT 'The community',
  `user_id` int(10) unsigned NOT NULL COMMENT 'The existing user',
  `banned` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Defines if a user is banned from this specific community',
  `newsletter` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Is the user subscribed to the newsletter for this community',
  `email_notification` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT 'If the user accepts to receive notifications by email',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'The time the user joined this community',
  PRIMARY KEY (`community_id`,`user_id`),
  KEY `communityuser_user` (`user_id`),
  KEY `community_index` (`community_id`),
  CONSTRAINT `communityuser_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Defines which user belongs to which community';
@ghost ghost assigned rcoelho Feb 10, 2013
@rcoelho
Copy link
Owner

rcoelho commented Feb 10, 2013

Thanks for your feature request!

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

No branches or pull requests

2 participants