quinta-feira, 10 de agosto de 2017

Doctrine 2 command sheet

orm:schema-tool

  • vendor/bin/doctrine orm:schema-tool:create: creates database's tables and their columns from scratch according the Entities Metadata.
  • vendor/bin/doctrine orm:schema-tool:update [--dump-sql] [--force]: update database's tables and their columns according the Entities Metadata.

orm:convert-mapping

  • vendor/bin/doctrine orm:convert-mapping [--from-database] [destination metadata type] [destination folder path]: convert Entities Metadata files from the current format to [destination metadata type] format and save them on [destination folder path].
    • The available values for [destination metadata type] are: xml, yaml and annotation.
    • If the param [--from-database] was suplied the input Metadata used to produce the output Metadata will be the current database's tables, instead of current Metadata infos. This is a great way to reverse ingeneer a database to Entities.

orm:generate

vendor/bin/doctrine orm:generate:entities [destination folder path]: generate Entities Classes files from the current Metadata files.

source: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/tools.html

quarta-feira, 19 de julho de 2017

MySQL Backup and Restoration Scripts

#!/bin/bash
PASSWORD=XXXXXX
HOST=XXXXXX
USER=XXXXXX
DATABASE=databasename
DB_FILE=dump.sql
EXCLUDED_TABLES=(
table1
table2
table3
table4
tableN   
)

IGNORED_TABLES_STRING=''
for TABLE in "${EXCLUDED_TABLES[@]}"
do :
   IGNORED_TABLES_STRING+=" --ignore-table=${DATABASE}.${TABLE}"
done

echo "Dump structure"
mysqldump --host=${HOST} --user=${USER} --password=${PASSWORD} --single-transaction --no-data ${DATABASE} > ${DB_FILE}

echo "Dump content"
mysqldump --host=${HOST} --user=${USER} --password=${PASSWORD} ${DATABASE} --no-create-info ${IGNORED_TABLES_STRING} >> ${DB_FILE}

Original source: https://stackoverflow.com/questions/425158/skip-certain-tables-with-mysqldump/425172

quarta-feira, 12 de julho de 2017

Restrict users from changing the wallpaper in Windows

Navigate to the following registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\ CurrentVersion\Policies\System
Create a new string value called "Wallpaper" and set it to the full path and filename of the image.
Additionally, to specify the display style, create a new string value called "WallpaperStyle" and set it to either "0", "1" or "2" according to the list below.
  • 0 - Centered (Default)
  • 1 - Tiled
  • 2 - Stretched
NOTE: You may need to restart Windows for the changes to take effect.
Original Source: https://support.microsoft.com/en-us/help/555429