frioux / DBIx-Class-DeploymentHandler

https://metacpan.org/pod/DBIx::Class::DeploymentHandler
20 stars 25 forks source link

unexpected DROP TABLE is generated #59

Closed KES777 closed 6 years ago

KES777 commented 6 years ago

this commit introduces the bug when for upgrade script DROP TABLE is generated

Now my upgrade scripts look like:

--- a/share/migrations/PostgreSQL/upgrade/20-21/001-auto.sql
+++ b/share/migrations/PostgreSQL/upgrade/20-21/001-auto.sql
@@ -4,6 +4,7 @@
 BEGIN;

 ;
+DROP TABLE "ips" CASCADE;
 CREATE TABLE "ips" (
   "id" serial NOT NULL,
   "subnet_id" integer NOT NULL,
@@ -16,6 +17,7 @@ CREATE TABLE "ips" (
 CREATE  INDEX "ips_idx_subnet_id" on "ips" ("subnet_id");

 ;
+DROP TABLE "localities" CASCADE;
 CREATE TABLE "localities" (
   "id" serial NOT NULL,
   "name" character varying(64) NOT NULL,
KES777 commented 6 years ago

maybe further actions are required because of TODO or default value for add_drop_table should be changed to 0 here or removed at all because it is provided here

frioux commented 6 years ago

Yeah I think I'll remove the default of 1 in your second link. Thanks so much for tracking the details down here

-- Sent from a rotary phone rented from Ma Bell

On Dec 28, 2017 7:05 AM, "Eugen Konkov" notifications@github.com wrote:

maybe further actions are required because of TODO https://metacpan.org/source/ILMARI/SQL-Translator-0.11023/lib/SQL/Translator/Diff.pm#L275 or default value for add_drop_table should be changed to 0 here https://metacpan.org/source/MMCCLIMON/DBIx-Class-DeploymentHandler-0.002221/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm#L439

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/frioux/DBIx-Class-DeploymentHandler/issues/59#issuecomment-354285494, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAf47ERxt3LhWaXwqFMqNe6G3v3mFOcks5tE5IWgaJpZM4ROTb_ .

frioux commented 6 years ago

Fixed in 0.002222