[DBIx-Class-Devel] [dbsrgits/sql-translator] Dependency tree/Object ordering (#108)

Eugen Konkov notifications at github.com
Thu Jul 19 09:05:24 GMT 2018


In deployment script I have:
```
CREATE TABLE "saldoanal" (
  "nyear" smallint NOT NULL,
  "nmonth" smallint NOT NULL,
   ...
  CONSTRAINT "saldoanal_kol_sum" CHECK (balance_ingerity_check( .... ))
);
```
then after table statements function is created:
```
CREATE FUNCTION "balance_ingerity_check" (....)
 RETURNS boolean
.....
```

And of course trying to deploy schema cause error:
```
ERROR:  function balance_ingerity_check(tbuhschet, tkol, tmoney, tkol, tmoney) does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
```

full error message:
```
failed to run SQL in /home/kes/work/projects/safevpn/repo2/share/migrations/PostgreSQL/deploy/76/001-auto.sql: DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::try {...} (): DBI Exception: DBD::Pg::db do failed: ERROR:  function balance_ingerity_check(tbuhschet, tkol, tmoney, tkol, tmoney) does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts. at inline delegation in DBIx::Class::DeploymentHandler for deploy_method->deploy (attribute declared in /home/kes/work/projects/safevpn/repo2/local/lib/perl5/DBIx/Class/DeploymentHandler/WithApplicatorDumple.pm at line 51) line 18
 (running line 'CREATE TABLE "saldoanal" ( "nyear" smallint NOT NULL, "nmonth" smallint NOT NULL, "schet" tbuhschet NOT NULL, "analitid1" integer DEFAULT 0 NOT NULL, "analitid2" integer DEFAULT 0 NOT NULL, "koldeb" tkol DEFAULT '0' NOT NULL, "sumdeb" tmoney DEFAULT '0' NOT NULL, "kolkred" tkol DEFAULT '0' NOT NULL, "sumkred" tmoney DEFAULT '0' NOT NULL, PRIMARY KEY ("nyear", "nmonth", "schet", "analitid1", "analitid2"), CONSTRAINT "saldoanal_kol_sum" CHECK (balance_ingerity_check(Schet, KolDeb, SumDeb, KolKred, SumKred)) )') at /home/kes/work/projects/safevpn/repo2/local/lib/perl5/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 248.
DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /home/kes/work/projects/safevpn/repo2/local/bin/dbic-migration line 0
DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /home/kes/work/projects/safevpn/repo2/local/bin/dbic-migration line 0
Makefile:148: recipe for target 'dbdeploy' failed
make: *** [dbdeploy] Error 255
```

The independent objects must be created first.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/issues/108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20180719/99524861/attachment.htm>


More information about the DBIx-Class-Devel mailing list