Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Default values in model #11

Open
nasht00 opened this Issue · 1 comment

2 participants

@nasht00

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';
@rcoelho rcoelho was assigned
@rcoelho
Owner

Thanks for your feature request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.