Skip to content

Commit

Permalink
updating table structure for orders and a few other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed May 20, 2010
1 parent a60760c commit 03ba436
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 3 deletions.
155 changes: 155 additions & 0 deletions config/migrations/082_general_changes.php
@@ -0,0 +1,155 @@
<?php
class M4bf54213ffdc4bc396a311046318cd70 extends CakeMigration {

/**
* Migration description
*
* @var string
* @access public
*/
public $description = '';

/**
* Actions to be performed
*
* @var array $migration
* @access public
*/
public $migration = array(
'up' => array(
'create_table' => array(
'order_clients' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'user_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'order_count' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM'),
),
'order_items' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 200),
'product_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'price' => array('type' => 'float', 'null' => false, 'default' => '0'),
'quantity' => array('type' => 'integer', 'null' => false, 'default' => '1'),
'order_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
),
'order_orders' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'user_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'address_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'special_instructions' => array('type' => 'text', 'null' => false, 'default' => NULL),
'payment_method' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 50),
'shipping_method' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 50),
'tracking_number' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 20),
'item_count' => array('type' => 'integer', 'null' => false, 'default' => '0'),
'total' => array('type' => 'float', 'null' => false, 'default' => NULL),
'shipping' => array('type' => 'float', 'null' => false, 'default' => NULL),
'status_id' => array('type' => 'integer', 'null' => false, 'default' => '1'),
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'),
),
'order_statuses' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 50),
'description' => array('type' => 'text', 'null' => false, 'default' => NULL),
'ordering' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'order_count' => array('type' => 'integer', 'null' => false, 'default' => '0'),
'deleted' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
'deleted_date' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM'),
),
),
'create_field' => array(
'core_addresses' => array(
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL),
),
'core_tickets' => array(
'expires' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
),
'newsletter_campaigns' => array(
'deleted' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 1),
'deleted_date' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
),
'newsletter_templates' => array(
'delete' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
'deleted_date' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
),
'shop_products' => array(
'sales' => array('type' => 'integer', 'null' => false, 'default' => '0'),
),
),
'drop_field' => array(
'core_tickets' => array('created',),
),
'alter_field' => array(
'core_tickets' => array(
'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36, 'key' => 'primary'),
),
),
),
'down' => array(
'drop_table' => array(
'order_clients', 'order_items', 'order_orders', 'order_statuses'
),
'drop_field' => array(
'core_addresses' => array('foreign_key',),
'core_tickets' => array('expires',),
'newsletter_campaigns' => array('deleted', 'deleted_date',),
'newsletter_templates' => array('delete', 'deleted_date',),
'shop_products' => array('sales',),
),
'create_field' => array(
'core_tickets' => array(
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
),
),
'alter_field' => array(
'core_tickets' => array(
'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 32, 'key' => 'primary'),
),
),
),
);

/**
* Before migration callback
*
* @param string $direction, up or down direction of migration process
* @return boolean Should process continue
* @access public
*/
public function before($direction) {
return true;
}

/**
* After migration callback
*
* @param string $direction, up or down direction of migration process
* @return boolean Should process continue
* @access public
*/
public function after($direction) {
return true;
}
}
?>
2 changes: 2 additions & 0 deletions config/migrations/map.php
Expand Up @@ -36,5 +36,7 @@
'082_adding_table_for_ticktes' => 'M4beb4cb980ac4fdc98bf1e986318cd70'),
18 => array(
'082_table_for_creating_short_urls' => 'M4becae321ae84cd8902409746318cd70'),
19 => array(
'082_general_changes' => 'M4bf54213ffdc4bc396a311046318cd70'),
);
?>
63 changes: 60 additions & 3 deletions config/schema/schema.php
@@ -1,6 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/* Infinitas schema generated on: 2010-05-14 04:05:42 : 1273802382*/
/* Infinitas schema generated on: 2010-05-20 17:05:05 : 1274364545*/
class InfinitasSchema extends CakeSchema {
var $name = 'Infinitas';

Expand Down Expand Up @@ -232,6 +232,7 @@ function after($event = array()) {
'continent_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'plugin' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 50),
'model' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 50),
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
Expand Down Expand Up @@ -500,9 +501,9 @@ function after($event = array()) {
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
var $core_tickets = array(
'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 32, 'key' => 'primary'),
'id' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36, 'key' => 'primary'),
'data' => array('type' => 'text', 'null' => false, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'expires' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
Expand Down Expand Up @@ -592,6 +593,8 @@ function after($event = array()) {
'locked' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
'locked_by' => array('type' => 'integer', 'null' => true, 'default' => NULL),
'locked_since' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'deleted' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 1),
'deleted_date' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
Expand Down Expand Up @@ -648,11 +651,64 @@ function after($event = array()) {
'locked' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
'locked_by' => array('type' => 'integer', 'null' => true, 'default' => NULL),
'locked_since' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'delete' => array('type' => 'boolean', 'null' => false, 'default' => NULL),
'deleted_date' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'name' => array('column' => 'name', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
var $order_clients = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'user_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'order_count' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $order_items = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 200),
'product_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'price' => array('type' => 'float', 'null' => false, 'default' => '0'),
'quantity' => array('type' => 'integer', 'null' => false, 'default' => '1'),
'order_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
var $order_orders = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'user_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'address_id' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'special_instructions' => array('type' => 'text', 'null' => false, 'default' => NULL),
'payment_method' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 50),
'shipping_method' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 50),
'tracking_number' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 20),
'item_count' => array('type' => 'integer', 'null' => false, 'default' => '0'),
'total' => array('type' => 'float', 'null' => false, 'default' => NULL),
'shipping' => array('type' => 'float', 'null' => false, 'default' => NULL),
'status_id' => array('type' => 'integer', 'null' => false, 'default' => '1'),
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
);
var $order_statuses = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 50),
'description' => array('type' => 'text', 'null' => false, 'default' => NULL),
'ordering' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'order_count' => array('type' => 'integer', 'null' => false, 'default' => '0'),
'deleted' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
'deleted_date' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MyISAM')
);
var $relation_relation_types = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 100),
Expand Down Expand Up @@ -794,6 +850,7 @@ function after($event = array()) {
'views' => array('type' => 'integer', 'null' => false, 'default' => '0'),
'added_to_cart' => array('type' => 'integer', 'null' => false, 'default' => '0'),
'added_to_wishlist' => array('type' => 'integer', 'null' => false, 'default' => '0'),
'sales' => array('type' => 'integer', 'null' => false, 'default' => '0'),
'supplier_id' => array('type' => 'integer', 'null' => true, 'default' => NULL),
'deleted' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
'deleted_date' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
Expand Down

0 comments on commit 03ba436

Please sign in to comment.