X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F08postgres-to-mysql.t;h=ff365e1f2151df14aa5dd7100635e31211f8c1a4;hb=90089d638fc1c611a3c23651edb096546c19f38f;hp=e2c9151a947bba73b38cc2a91e9b1fe3d7e25ddb;hpb=08f434d77a3dc7d5e1adbc7efb7d41d59cb9b44f;p=dbsrgits%2FSQL-Translator.git diff --git a/t/08postgres-to-mysql.t b/t/08postgres-to-mysql.t index e2c9151..ff365e1 100644 --- a/t/08postgres-to-mysql.t +++ b/t/08postgres-to-mysql.t @@ -2,13 +2,21 @@ # vim: set ft=perl: use strict; -use Test::More 'no_plan'; # tests => 1; +use Test::More; use SQL::Translator; use Data::Dumper; +use Test::SQL::Translator qw(maybe_plan); + +BEGIN { + maybe_plan(1, + 'SQL::Translator::Parser::PostgreSQL', + 'SQL::Translator::Producer::MySQL', + ); +} my $create = q| --- The cvterm module design is based on the ontology +-- The cvterm module design is based on the ontology -- ================================================ -- TABLE: cv @@ -41,10 +49,25 @@ create table cvterm ( ); create index cvterm_idx1 on cvterm (cv_id); -- the primary dbxref for this term. Other dbxrefs may be cvterm_dbxref --- The unique key on termname, termtype_id ensures that all terms are +-- The unique key on termname, termtype_id ensures that all terms are -- unique within a given cv +COMMENT ON TABLE cvterm IS + 'A term, class or concept within an ontology + or controlled vocabulary'; +COMMENT ON COLUMN cvterm.cv_id IS + 'The cv/ontology/namespace to which this cvterm belongs'; +COMMENT ON COLUMN cvterm.name IS + 'A concise human-readable name describing the meaning of the cvterm'; +COMMENT ON COLUMN cvterm.termdefinition IS + 'A human-readable text definition'; +COMMENT ON COLUMN cvterm.dbxref_id IS + 'A human-readable text definition'; +COMMENT ON INDEX cvterm_c1 IS + 'the OBO identifier is globally unique'; + + -- ================================================ -- TABLE: cvrelationship -- ================================================ @@ -102,7 +125,10 @@ create table cvtermsynonym ( unique(cvterm_id, termsynonym) ); -create index cvterm_synonym_idx1 on cvterm_synonym (cvterm_id); + +-- The table "cvterm_synonym" doesn't exist, so +-- creating an index on it screws things up! +-- create index cvterm_synonym_idx1 on cvterm_synonym (cvterm_id); -- ================================================ -- TABLE: cvterm_dbxref @@ -121,6 +147,23 @@ create table cvterm_dbxref ( create index cvterm_dbxref_idx1 on cvterm_dbxref (cvterm_id); create index cvterm_dbxref_idx2 on cvterm_dbxref (dbxref_id); +-- ================================================ +-- TABLE: cvterm_geom +-- ================================================ + +create table cvterm_geom ( + cvterm_geom_id serial not null, + primary key (cvterm_geom_id), + cvterm_id int not null, + foreign key (cvterm_id) references cvterm (cvterm_id), + cvterm_geom geometry, + constraint "enforce_dims_cvterm_geom" CHECK ((st_ndims(cvterm_geom) = 2)), + constraint "enforce_srid_cvterm_geom" CHECK ((st_srid(cvterm_geom) = -1)), + constraint "enforce_geotype_cvterm_geom" CHECK ((geometrytype(cvterm_geom) = 'POINT'::text OR cvterm_geom IS NULL)), + unique(cvterm_id) +); + + |; my $tr = SQL::Translator->new( @@ -128,4 +171,4 @@ my $tr = SQL::Translator->new( producer => "MySQL" ); -ok( $tr->translate(\$create), 'Translate PG2My' ); +ok( $tr->translate(\$create), 'Translate PG2My' ) or diag($tr->error);