User tests: Successful: Unsuccessful:
this is the continuation of the work made by @Hackwar #10991
you can run the cli script to export tables
php exporter.php --all --folder <folder_path>
export all tables and data to the folder
php exporter.php --all --mode zip
export all tables and data in zip file
php exporter.php --table <table_name>
export table name
php exporter.php --table <table_name> --mode zip
export table name as a .zip file
you can run the cli script to import tables
php importer.php --all --folder <folder_path>
php importer.php --table <table_name>
Status | New | ⇒ | Pending |
Category | ⇒ | CLI Libraries Postgresql MS SQL |
Labels |
Added:
?
|
Title |
|
Category | CLI Libraries Postgresql MS SQL | ⇒ | CLI Libraries Postgresql MS SQL Unit Tests |
Labels |
Added:
?
|
I have tested this item
i have tested it giving my own folder_path, but it always create a folder dbdump where it sets the result.
Is it the right way?
@icampus
I have tested this item
Tested successfully on Windows.
Command php exporter.php --all --folder C:\Users\user\Desktop\tables\
created the folder tables
as expected.
sorry but don't understand is the same command issued by @jonasgonka
I think the problem is that he is missing the last backslash.
Maybe it would be better to switch to using actual directories in the script instead of just the strings.
Exporter works fine (without error) when I include a slash (backslash with Window) at the end of the folder.
Importer gives no error.
But after all, when I try to write in the database, creating an article for example, I have this error :
Error
Save failed with the following error: ERROR: null value in column "id" violates not-null constraint
I did my test with the postgresql driver.
Is it possible to use the importer directly with a zip file previously created by the exporter ?
Importer failed with the PostgreSQL PDO driver :
DbImporterCli
============================
Importing gvcms_action_log_config from gvcms_action_log_config.xml
Reading data from gvcms_action_log_config.xml
Drop gvcms_action_log_config
Error on mergeStructuregvcms_action_log_config.xml JDatabaseExceptionExecuting: 00000, , in /var/www/html/avenirdurable/libraries/joomla/database/driver/pdo.php:475
Stack trace:
#0 /var/www/html/avenirdurable/libraries/joomla/database/importer.php(251): JDatabaseDriverPdo->execute()
#1 /var/www/html/avenirdurable/cli/importer.php(139): JDatabaseImporter->mergeStructure()
#2 /var/www/html/avenirdurable/libraries/src/Application/CliApplication.php(143): DbImporterCli->doExecute()
#3 /var/www/html/avenirdurable/cli/importer.php(170): Joomla\CMS\Application\CliApplication->execute()
#4 {main}
@jonasgonka , could you specify which database driver you used ?
Structure parameters are missing.
gvcms_content_id_seq is incorrect in the postgresql database.
We should have yes (instead of no) for
Will increment last value before returning next value (is_called)?
Last value is 1 instead of 30 (in my test case).
In addition, the gvcms_content table is incomplete in the postgresql database. We have no default value. For id, this should be:
nextval('public.gvcms_content_id_seq'::regclass)
Please, replace ($field->default
):
$field->Default
): (isset($field->Default) ? ' Default="' . $field->Default . '"' : '') . ' Comments="' . $field->comments . '"' .
It fixes (#14272 (comment)):
We have no default value.
We could add Is_called="YES
at the sequence:
' Cycle_option="' . $sequence->cycle_option . '"' . ' Is_called="YES"' .
We have to clean default value, adding:
$cDefault = strstr($field['Default'], '::', true);
if ($cDefault != false) { $field['Default'] = $cDefault; }
before:
joomla-cms/libraries/joomla/database/importer/postgresql.php
Lines 487 to 489 in 786aa3d
Modify :
@twister65 sorry for not be so responsive in these days,
yes the postgresql import/export need a little bit more care, hope i should be more free in the next weeks
PostgreSQL.
The last value in the sequences is not defined (1). When a new row is added to a table, the id is incorrect (1).
Thanks @alikon , could you modify the cli script to add a driver parameter ?
For example, migrate a PostgreSQL database (export) to a MySQL database (import).
I appreciate this PR, especially since Akeeba Backup does not support PostgreSQL.
In addition, I plan to migrate my PostgreSQL database to MySQL.
I hope it will work well someday. I expect a lot from this PR.
Regards.
I appreciate this PR, especially since Akeeba Backup does not support PostgreSQL.
It does
Akeeba Database backup engine is :
There is no Native PostgreSQL engine. I never succeeded to make reverse engineering work.
Instead I use pg_dump to make a backup.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-01-13 08:07:10 |
Closed_By | ⇒ | alikon |
@alikon i have found a few more places ;)