Book Image

Yii Project Blueprints

By : Charles R. Portwood ll
Book Image

Yii Project Blueprints

By: Charles R. Portwood ll

Overview of this book

Table of Contents (15 chapters)
Yii Project Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating the database


With our dependencies and configuration files in place, we can now create our database. Using the yiic command, create a migration called users and a migration called reminders.

The users migration

The users migration will create the users database and ensure that no duplicate e-mail address can be entered at the database level. Within the protected/migrations folder, open up the users migration:

In the up() method, add the following:

$this->createTable('users', array(
   'id'           => 'pk',
   'email'        => 'string',
   'password'     => 'string',
   'created'      => 'integer',
   'updated'      => 'integer'
));

Note

You may notice that the column types we selected do not match up with MySQL column types. This is because we are allowing Yii to determine the appropriate column type for the database adapter we are using. This allows interoperability between multiple database drivers, meaning that we could seamlessly swap the underlying database...