diff --git a/README.md b/README.md index 4cde974..5966685 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ if ($this->db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } -$this->createTable('Subscription', [ +$this->createTable('subscription', [ 'id' => $this->primaryKey(), 'userId' => $this->integer()->notNull(), 'name' => $this->string()->notNull(), @@ -54,10 +54,10 @@ $this->createTable('Subscription', [ 'updatedAt' => $this->timestamp()->null() ], $tableOptions); -$this->addColumn('User', 'stripeId', $this->string()); -$this->addColumn('User', 'cardBrand', $this->string()); -$this->addColumn('User', 'cardLastFour', $this->string()); -$this->addColumn('User', 'trialEndAt', $this->timestamp()->null()); +$this->addColumn('user', 'stripeId', $this->string()); +$this->addColumn('user', 'cardBrand', $this->string()); +$this->addColumn('user', 'cardLastFour', $this->string()); +$this->addColumn('user', 'trialEndAt', $this->timestamp()->null()); ``` > Also you can apply migration by the following command: diff --git a/migrations/m160511_085953_init.php b/migrations/m160511_085953_init.php index ea06c18..3f5c614 100644 --- a/migrations/m160511_085953_init.php +++ b/migrations/m160511_085953_init.php @@ -15,7 +15,7 @@ public function up() $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } - $this->createTable('Subscription', [ + $this->createTable('subscription', [ 'id' => $this->primaryKey(), 'userId' => $this->integer()->notNull(), 'name' => $this->string()->notNull(), @@ -28,19 +28,20 @@ public function up() 'updatedAt' => $this->timestamp()->null() ], $tableOptions); - $this->addColumn('User', 'stripeId', $this->string()); - $this->addColumn('User', 'cardBrand', $this->string()); - $this->addColumn('User', 'cardLastFour', $this->string()); - $this->addColumn('User', 'trialEndAt', $this->timestamp()->null()); + $this->addColumn('user', 'stripeId', $this->string()); + $this->addColumn('user', 'cardBrand', $this->string()); + $this->addColumn('user', 'cardLastFour', $this->string()); + $this->addColumn('user', 'trialEndAt', $this->timestamp()->null()); } public function down() { - $this->dropTable('Subscription'); - $this->dropColumn('User', 'stripeId'); - $this->dropColumn('User', 'cardBrand'); - $this->dropColumn('User', 'cardLastFour'); - $this->dropColumn('User', 'trialEndAt'); + $this->dropTable('subscription'); + + $this->dropColumn('user', 'stripeId'); + $this->dropColumn('user', 'cardBrand'); + $this->dropColumn('user', 'cardLastFour'); + $this->dropColumn('user', 'trialEndAt'); } /* diff --git a/models/SubscriptionModel.php b/models/SubscriptionModel.php index 61ce0ba..32a7c7d 100644 --- a/models/SubscriptionModel.php +++ b/models/SubscriptionModel.php @@ -47,7 +47,7 @@ class SubscriptionModel extends ActiveRecord */ public static function tableName() { - return 'Subscription'; + return 'subscription'; } /** diff --git a/tests/TestCase.php b/tests/TestCase.php index 6b01ee7..e194d77 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -84,7 +84,7 @@ protected function setupTestDbData() // Structure : - $db->createCommand()->createTable('Subscription', [ + $db->createCommand()->createTable('subscription', [ 'id' => 'pk', 'userId' => 'integer not null', 'name' => 'string not null', @@ -97,7 +97,7 @@ protected function setupTestDbData() 'updatedAt' => 'timestamp null default null', ])->execute(); - $db->createCommand()->createTable('User', [ + $db->createCommand()->createTable('user', [ 'id' => 'pk', 'username' => 'string', 'email' => 'string', @@ -107,7 +107,7 @@ protected function setupTestDbData() 'trialEndAt' => 'timestamp null default null', ])->execute(); - $db->createCommand()->insert('User', [ + $db->createCommand()->insert('user', [ 'username' => 'John Doe', 'email' => 'johndoe@domain.com' ])->execute(); diff --git a/tests/data/User.php b/tests/data/User.php index c372007..47f94d4 100644 --- a/tests/data/User.php +++ b/tests/data/User.php @@ -20,7 +20,7 @@ class User extends ActiveRecord implements IdentityInterface */ public static function tableName() { - return 'User'; + return 'user'; } /**