package SQL::Translator::Producer::PostgreSQL;
# -------------------------------------------------------------------
-# $Id: PostgreSQL.pm,v 1.27 2006-11-10 21:21:51 mwz444 Exp $
+# $Id: PostgreSQL.pm,v 1.28 2006-11-20 23:56:14 schiffbruechige Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use warnings;
use vars qw[ $DEBUG $WARN $VERSION ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.27 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.28 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 1 unless defined $DEBUG;
use SQL::Translator::Schema::Constants;
my $create_statement;
$create_statement = join("\n", @comments);
- $create_statement .= qq[DROP TABLE $qt$table_name_ur$qt;\n]
+ $create_statement .= qq[DROP TABLE $qt$table_name_ur$qt CASCADE;\n]
if $add_drop_table;
$create_statement .= qq[CREATE TABLE $qt$table_name_ur$qt (\n].
join( ",\n", map { " $_" } @field_defs, @constraint_defs ).
) or die $sqlt->error;
is($sql, << "SQL");
-DROP TABLE "Basic";
+DROP TABLE "Basic" CASCADE;
CREATE TABLE "Basic" (
"id" serial NOT NULL,
"title" character varying(100) DEFAULT 'hello' NOT NULL,
CREATE INDEX "titleindex" on "Basic" ("title");
-DROP TABLE "Another";
+DROP TABLE "Another" CASCADE;
CREATE TABLE "Another" (
"id" serial NOT NULL,
PRIMARY KEY ("id")
) or die $sqlt->error;
is($sql, << "SQL");
-DROP TABLE "one";
+DROP TABLE "one" CASCADE;
CREATE TABLE "one" (
"same" character varying(100) DEFAULT 'hello' NOT NULL
);
-DROP TABLE "two";
+DROP TABLE "two" CASCADE;
CREATE TABLE "two" (
"same" character varying(100) DEFAULT 'hello' NOT NULL
);