refactor module to itegrate with InflateColumn::DateTime and TimeStamp
[dbsrgits/DBIx-Class-DateTime-Epoch.git] / t / lib / MySchema / Foo.pm
diff --git a/t/lib/MySchema/Foo.pm b/t/lib/MySchema/Foo.pm
new file mode 100644 (file)
index 0000000..ca4f5ba
--- /dev/null
@@ -0,0 +1,46 @@
+package MySchema::Foo;
+
+use strict;
+use warnings;
+
+use base qw( DBIx::Class );
+
+__PACKAGE__->load_components( qw( DateTime::Epoch TimeStamp Core ) );
+__PACKAGE__->table( 'foo' );
+__PACKAGE__->add_columns(
+    id => {
+        data_type         => 'bigint',
+        is_auto_increment => 1,
+        is_nullable       => 0,
+    },
+    name => {
+        data_type   => 'varchar',
+        size        => 10,
+        is_nullable => 1,
+    },
+    bar => { # epoch stored as an int
+        data_type        => 'bigint',
+        inflate_datetime => 1,
+    },
+    baz => { # epoch stored as a string
+        data_type        => 'varchar',
+        size             => 50,
+        inflate_datetime => 'epoch',
+    },
+    # working in conjunction with DBIx::Class::TimeStamp
+    creation_time => {
+        data_type        => 'bigint',
+        inflate_datetime => 1,
+        set_on_create    => 1,
+    },
+    modification_time => {
+        data_type        => 'bigint',
+        inflate_datetime => 1,
+        set_on_create    => 1,
+        set_on_update    => 1,
+    }
+);
+
+__PACKAGE__->set_primary_key( 'id' );
+
+1;