Page 1 of 1
LinqConnect Professional Version 4.5.1004 (09-Jun-2016) - Delete database PostgreSql
Posted: Tue 21 Jun 2016 14:56
by AKRRKA
Does not work the delete database for PostgreSql.
When running DeleteDatabase() command, like this:
Code: Select all
contextForDeleteDatabase.DeleteDatabase(false, true);
generated incorrect code:
that's the correct code:
For information:
Code: Select all
ConnectionString="user id=postgres;password=masterpass;host=10.5.5.1;database=cetest;persist security info=True;unicode=True;schema=public"
Re: LinqConnect Professional Version 4.5.1004 (09-Jun-2016) - Delete database PostgreSql
Posted: Wed 22 Jun 2016 09:23
by Shalex
The correct behaviuor is described in the
documentation:
"Creates and executes script that deletes database tables with their constraints, indexes, and foreign keys.
If deleteSchema is set to true, the schema will be deleted.
The database or schema itself is not deleted."
Re: LinqConnect Professional Version 4.5.1004 (09-Jun-2016) - Delete database PostgreSql
Posted: Wed 22 Jun 2016 15:14
by AKRRKA
Do not understand.
1) For MS SQL Server and MySQL when deleting base executed correct command.
2) For PostgreSQL executed an incorrect command.
Is necessary for PostgreSQL do the right commands.
I showed an example of the correct command.
You want to say that this will not work?
Re: LinqConnect Professional Version 4.5.1004 (09-Jun-2016) - Delete database PostgreSql
Posted: Wed 29 Jun 2016 11:49
by Shalex
If deleteSchema is set to true, the behaviour is the following:
DROP DATABASE is generated for SQL Server
DROP DATABASE is generated for MySQL
DROP SCHEMA is generated for PostgreSQL
DROP USER is generated Oracle
the database file is removed from file system in case of SQLite
The DeleteDatabase(false,true) was designed to remove the smallest "container" of database objects. For PostgreSQL, it is a schema. The behaviour change may lead to the unexpected result (removing database) for other customers, so we preserve current way how it works.
Re: LinqConnect Professional Version 4.5.1004 (09-Jun-2016) - Delete database PostgreSql
Posted: Thu 30 Jun 2016 08:56
by AKRRKA
Well, for "PostgreSql" type I tried that.
Code: Select all
contextForDeleteDatabase.DeleteDatabase(false, false);
But so, too, the database is not removed. Only remove the table. Generated commands like:
Code: Select all
...
DROP TABLE "AddressCities" CASCADE
...
How to remove the database itself?
Re: LinqConnect Professional Version 4.5.1004 (09-Jun-2016) - Delete database PostgreSql
Posted: Fri 01 Jul 2016 17:15
by Shalex
There are two ways to remove database:
1) via ADO.NET connection (PgSqlConnection), connect to other database (e.g., "postgres") and execute cmd.CommandText="drop database cetest"
2) implement your own descendant of a standard PgSqlDataProvider class, override its DeleteDatabase method, and employ your own class instead of a standard PgSqlDataProvider class