Added support for temp columns and ->make_read_only
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / ReadOnly.pm
diff --git a/lib/DBIx/Class/CDBICompat/ReadOnly.pm b/lib/DBIx/Class/CDBICompat/ReadOnly.pm
new file mode 100644 (file)
index 0000000..fe1d902
--- /dev/null
@@ -0,0 +1,13 @@
+package DBIx::Class::CDBICompat::ReadOnly;
+
+use strict;
+use warnings;
+
+sub make_read_only {
+  my $proto = shift;
+  $proto->add_trigger("before_$_" => sub { shift->throw("$proto is read only") })
+    foreach qw/create delete update/;
+  return $proto;
+}
+
+1;