Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Modyllic_Column -> Modyllic_Schema_Column

  • Loading branch information...
commit 9092f2b44c9bedeeac3dfe65b817bde6a6d97824 1 parent cb36f40
@iarna authored
View
6 Modyllic/Diff.php
@@ -569,7 +569,7 @@ function __construct($name) {
/**
* Note that a column was added
- * @param Modyllic_Column $column
+ * @param Modyllic_Schema_Column $column
*/
function add_column($column) {
$this->add['columns'][$column->name] = $column;
@@ -577,7 +577,7 @@ function add_column($column) {
/**
* Note that a column was removed
- * @param Modyllic_Column $column
+ * @param Modyllic_Schema_Column $column
*/
function remove_column($column) {
$this->remove['columns'][$column->name] = $column;
@@ -585,7 +585,7 @@ function remove_column($column) {
/**
* Note that a column was updated
- * @param Modyllic_Column $column
+ * @param Modyllic_Schema_Column $column
*/
function update_column($column) {
$this->update['columns'][$column->name] = $column;
View
2  Modyllic/Parser.php
@@ -914,7 +914,7 @@ function maybe_table_option() {
function load_column() {
// ident type [NOT NULL|NULL] [DEFAULT value] [ON UPDATE token] [AUTO_INCREMENT]
// [PRIMARY KEY] [COMMENT string] [ALIASES (token,...)]
- $column = $this->ctx->add_column(new Modyllic_Column( $this->assert_ident() ));
+ $column = $this->ctx->add_column(new Modyllic_Schema_Column( $this->assert_ident() ));
$column->type = $this->get_type();
$is_unique = false;
View
43 Modyllic/Schema.php
@@ -12,6 +12,7 @@
// Components
require_once "Modyllic/Schema/Index.php";
require_once "Modyllic/Schema/Index/Foreign.php";
+require_once "Modyllic/Schema/Column.php";
/**
* A base class for various schema objects. Handles generic things like
@@ -259,7 +260,7 @@ function __construct($name) {
/**
- * @param Modyllic_Column $column
+ * @param Modyllic_Schema_Column $column
*/
function add_column($column) {
if ( isset($this->last_column) ) {
@@ -392,46 +393,6 @@ function match_row($row) {
}
-/**
- * A collection of attributes describing a column in a table
- */
-class Modyllic_Column extends Modyllic_Diffable {
- public $name;
- public $aliases = array();
- public $previously;
- public $type;
- public $null = true;
- public $default = "NULL";
- public $auto_increment = false;
- public $on_update;
- public $docs = "";
- public $after;
- public $is_primary;
-
- /**
- * @param string $name
- */
- function __construct($name) {
- $this->name = $name;
- }
-
-
- /**
- * @param Modyllic_Column $other
- * @returns bool True if $other is equivalent to $this
- */
- function equal_to($other) {
- if ( $this->name != $other->name ) { return false; }
- if ( ! $this->type->equal_to( $other->type ) ) { return false; }
- if ( $this->null != $other->null ) { return false; }
- if ( $this->default != $other->default ) { return false; }
- if ( $this->auto_increment != $other->auto_increment ) { return false; }
- if ( $this->on_update != $other->on_update ) { return false; }
- if ( $this->aliases != $other->aliases ) { return false; }
- return true;
- }
-}
-
class Modyllic_CodeBody extends Modyllic_Diffable {
public $body = "BEGIN\nEND";
/**
View
48 Modyllic/Schema/Column.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Copyright © 2012 Online Buddies, Inc. - All Rights Reserved
+ *
+ * @package Modyllic
+ * @author bturner@online-buddies.com
+ */
+
+/**
+ * A collection of attributes describing a column in a table
+ */
+class Modyllic_Schema_Column extends Modyllic_Diffable {
+ public $name;
+ public $aliases = array();
+ public $previously;
+ public $type;
+ public $null = true;
+ public $default = "NULL";
+ public $auto_increment = false;
+ public $on_update;
+ public $docs = "";
+ public $after;
+ public $is_primary;
+
+ /**
+ * @param string $name
+ */
+ function __construct($name) {
+ $this->name = $name;
+ }
+
+
+ /**
+ * @param Modyllic_Schema_Column $other
+ * @returns bool True if $other is equivalent to $this
+ */
+ function equal_to($other) {
+ if ( $this->name != $other->name ) { return false; }
+ if ( ! $this->type->equal_to( $other->type ) ) { return false; }
+ if ( $this->null != $other->null ) { return false; }
+ if ( $this->default != $other->default ) { return false; }
+ if ( $this->auto_increment != $other->auto_increment ) { return false; }
+ if ( $this->on_update != $other->on_update ) { return false; }
+ if ( $this->aliases != $other->aliases ) { return false; }
+ return true;
+ }
+}
+
View
2  test/General_Functional.t
@@ -37,7 +37,7 @@ is( $test_table->charset, "utf8", "The default charset got set" );
is( count($test_table->columns), 1, "One column found" );
is( count($test_table->indexes), 0, "No indexes found" );
$column = $test_table->columns['id'];
-ok( $column instanceOf Modyllic_Column, "Column id isa Modyllic_Column" );
+ok( $column instanceOf Modyllic_Schema_Column, "Column id isa Modyllic_Schema_Column" );
is( $column->name, "id", "Column name set" );
is( count($column->aliases), 0, "No aliases" );
ok( $column->type instanceOf Modyllic_Integer, "Column type set" );
Please sign in to comment.
Something went wrong with that request. Please try again.