¿Es posible hacer un drush sql-sync de solo ciertas tablas?

Pregunta:

Tengo 4 entornos entre mi local, desarrollo, puesta en escena y producción.

Diariamente se publica una gran cantidad de contenido en el entorno de ensayo, por lo que ese es el centro de mi flujo de trabajo. Una vez que el contenido se somete a control de calidad en la puesta en escena, se sincroniza mediante SQL con la producción. Esto funciona bien en este momento. Sin embargo, ahora vamos a permitir el registro de usuarios / contenido generado por usuarios. ¿Hay alguna manera de impulsar estas actualizaciones de contenido con sql-sync y nunca sobrescribir ciertas tablas? Incluso más específicamente, ¿hay algo que pueda colocar en drushrc.php que siempre salteará una lista de tablas en todos los entornos?

Respuesta:

Si sabe qué tablas desea transferir

--tables-list

Una lista de tablas separadas por comas para transferir. Opcional.

Si sabe qué tablas desea omitir

--skip-tables-list

Una lista de tablas separadas por comas para excluir por completo. Opcional.


Y así es como sé esto:


$ drush help sql-sync
Copy and import source database to target database. Transfers via rsync.

Examples:
 drush sql-sync @prod @dev                 Copy the DB defined in sites/prod to the DB in sites/dev.


Arguments:
 from                                      Name of subdirectory within /sites or a site-alias.
 to                                        Name of subdirectory within /sites or a site-alias.


Options:
 --cache                                   Skip dump if result file exists and is less than "cache" hours old. Optional; default is 24 hours.
 --create-db                               Create a new database before importing the database dump on the target machine.
 --db-su=                            Account to use when creating a new database. Optional.
 --db-su-pw=                         Password for the "db-su" account. Optional.
 --dump-dir                                Directory to store sql dump files in when --source-dump or --target-dump are not used.  Takes precedence over --temp.
 --no-cache                                Do not cache the sql-dump file.
 --no-dump                                 Do not dump the sql database; always use an existing dump file.
 --no-ordered-dump                         Do not pass --ordered-dump to sql-dump.  sql-sync orders the dumpfile by default in order to increase the efficiency of rsync.
 --sanitize                                Obscure email addresses and reset passwords in the user table post-sync. Optional.
   --sanitize-password                     The password to assign to all accounts in the sanitization operation, or "no" to keep passwords unchanged.  Default is "password".
   --sanitize-email                        The pattern for test email addresses in the sanitization operation, or "no" to keep email addresses unchanged.  May contain replacement patterns %uid,
                                           %mail or %name.  Default is "user+%uid@localhost".
   --confirm-sanitizations                 Prompt yes/no after importing the database, but before running the sanitizations
 --skip-tables-key                         A key in the $skip_tables array. @see example.drushrc.php. Optional.
 --skip-tables-list                        A comma-separated list of tables to exclude completely. Optional.
 --source-database                         A key in the $db_url (D6) or $databases (D7+) array which provides the data.
 --source-db-url                           Database specification for source system to dump from.
 --source-dump                             Path to dump file. Optional; default is to create a temporary file.
 --source-remote-host                      Remote machine to run sql-dump file on. Optional; default is local machine.
 --source-remote-port                      Override sql database port number in source-db-url. Optional.
 --structure-tables-key                    A key in the $structure_tables array. @see example.drushrc.php. Optional.
 --structure-tables-list                   A comma-separated list of tables to include for structure, but not data. Optional.
 --tables-key                              A key in the $tables array. Optional.
 --tables-list                             A comma-separated list of tables to transfer. Optional.
 --target-database                         A key in the $db_url (D6) or $databases (D7+) array which shall receive the data.
 --target-db-url
 --target-dump
 --target-remote-host
 --target-remote-port
 --temp                                    Use a temporary file to hold dump files.  Implies --no-cache.

Leave a Comment

Your email address will not be published. Required fields are marked *

web tasarım