initial
Justin Hunter [Thu, 28 May 2009 16:36:50 +0000 (09:36 -0700)]
lib/SQL/Translator.pm [new file with mode: 0644]
lib/SQL/Translator/Object.pm [new file with mode: 0644]
lib/SQL/Translator/Object/Column.pm [new file with mode: 0644]
lib/SQL/Translator/Object/Constraint.pm [new file with mode: 0644]
lib/SQL/Translator/Object/Index.pm [new file with mode: 0644]
lib/SQL/Translator/Object/Procedure.pm [new file with mode: 0644]
lib/SQL/Translator/Object/Schema.pm [new file with mode: 0644]
lib/SQL/Translator/Object/Table.pm [new file with mode: 0644]
lib/SQL/Translator/Object/Trigger.pm [new file with mode: 0644]
lib/SQL/Translator/Object/View.pm [new file with mode: 0644]

diff --git a/lib/SQL/Translator.pm b/lib/SQL/Translator.pm
new file mode 100644 (file)
index 0000000..78a0041
--- /dev/null
@@ -0,0 +1,3 @@
+package SQL::Translator;
+
+1;
diff --git a/lib/SQL/Translator/Object.pm b/lib/SQL/Translator/Object.pm
new file mode 100644 (file)
index 0000000..8e80f8b
--- /dev/null
@@ -0,0 +1,4 @@
+package SQL::Translator::Object;
+use base 'SQL::Translator';
+
+1;
diff --git a/lib/SQL/Translator/Object/Column.pm b/lib/SQL/Translator/Object/Column.pm
new file mode 100644 (file)
index 0000000..dcb4cb3
--- /dev/null
@@ -0,0 +1,11 @@
+package SQL::Translator::Object::Column;
+use Moose;
+
+has 'name' => (is => 'ro', isa => 'Str', required => 1);
+has 'type' => (is => 'ro', isa => 'Str', required => 1);
+has 'size' => (is => 'ro', isa => 'Int', required => 1);
+has 'nullable' => (is => 'ro', isa => 'Bool', required => 1, default => 1);
+has 'default' => (is => 'ro', isa => 'Str', required => 0);
+has 'trigger' => (is => 'ro', isa => 'SQL::Translator::Object::Trigger', required => 0);
+
+1;
diff --git a/lib/SQL/Translator/Object/Constraint.pm b/lib/SQL/Translator/Object/Constraint.pm
new file mode 100644 (file)
index 0000000..a604611
--- /dev/null
@@ -0,0 +1,8 @@
+package SQL::Translator::Object::Constraint;
+use Moose;
+
+has 'name' => (is => 'ro', isa => 'Str', required => 1);
+has 'columns' => (is => 'ro', isa => 'ArrayRef[SQL::Translator::Object::Column]', required => 1);
+has 'type' => (is => 'ro', isa => 'Str', required => 1);
+
+1;
diff --git a/lib/SQL/Translator/Object/Index.pm b/lib/SQL/Translator/Object/Index.pm
new file mode 100644 (file)
index 0000000..64d3554
--- /dev/null
@@ -0,0 +1,8 @@
+package SQL::Translator::Object::Index;
+use Moose;
+
+has 'name' => (is => 'ro', isa => 'Str', required => 1);
+has 'columns' => (is => 'ro', isa => 'ArrayRef[SQL::Translator::Object::Column]', required => 1);
+has 'type' => (is => 'ro', isa => 'Str', required => 1);
+
+1;
diff --git a/lib/SQL/Translator/Object/Procedure.pm b/lib/SQL/Translator/Object/Procedure.pm
new file mode 100644 (file)
index 0000000..d34cc8d
--- /dev/null
@@ -0,0 +1,4 @@
+package SQL::Translator::Object::Procedure;
+use Moose;
+
+1;
diff --git a/lib/SQL/Translator/Object/Schema.pm b/lib/SQL/Translator/Object/Schema.pm
new file mode 100644 (file)
index 0000000..7c151b9
--- /dev/null
@@ -0,0 +1,8 @@
+package SQL::Translator::Object::Schema;
+use Moose;
+
+has 'tables' => (is => 'ro', isa => 'ArrayRef[SQL::Translator::Object::Table]', required => 1);
+has 'views' => (is => 'ro', isa => 'ArrayRef[SQL::Translator::Object::View]', required => 0);
+has 'procedures' => (is => 'ro', isa => 'ArrayRef[SQL::Translator::Object::Procedure]', required => 0);
+
+1;
diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm
new file mode 100644 (file)
index 0000000..ac42c6e
--- /dev/null
@@ -0,0 +1,9 @@
+package SQL::Translator::Object::Table;
+use Moose;
+
+has 'name' => (is => 'ro', isa => 'Str', required => 1);
+has 'columns' => (is => 'ro', isa => 'ArrayRef[SQL::Translator::Object::Column]', required => 1);
+has 'indexes' => (is => 'ro', isa => 'ArrayRef[SQL::Translator::Object::Index]', required => 0);
+has 'constraints' => (is => 'ro', isa => 'ArrayRef[SQL::Translator::Object::Constraint]', required => 0);
+
+1;
diff --git a/lib/SQL/Translator/Object/Trigger.pm b/lib/SQL/Translator/Object/Trigger.pm
new file mode 100644 (file)
index 0000000..c9c9ed2
--- /dev/null
@@ -0,0 +1,6 @@
+package SQL::Translator::Object::Trigger;
+use Moose;
+
+has 'name' => (is => 'ro', isa => 'Str', required => 1);
+
+1;
diff --git a/lib/SQL/Translator/Object/View.pm b/lib/SQL/Translator/Object/View.pm
new file mode 100644 (file)
index 0000000..f0b4995
--- /dev/null
@@ -0,0 +1,7 @@
+package SQL::Translator::Object::View;
+use Moose;
+
+extends 'SQL::Translator::Object::Table';
+has 'sql' => (is => 'ro', isa => 'Str', required => 1);
+
+1;