Databases

From Buildtools
Jump to: navigation, search

MYSQL SERVERS[edit]

Sync Procedure[edit]

  • Developer will request to sync main db(develop database) with his db changes, then production and other dbs will be sync with develop.

Best Practices[edit]

  • For column names use: all lowercase, underscore to separte words.
  • For boolean columns use tiny(1).
  • Comment everywhere!, please add coments to all new created column.
  • use prefix dt_ for date/data-time columns

General structure[edit]

  • All tables needs an ID unique column.
  • is_draft column its required.
  • dt_created column its required.
  • dt_updated column its required.


Debugging MySQL queries[edit]

  • You will see somthing like:
  • time Query bindings
  • 38.78 select * from `company_info` limit 1
  • 1.39 select * from `user_groups_permissions` where `user_groups_id` = ? 1
  • 0.39 select count(*) as aggregate from `custom_fields` where `modules_code` = ?
  • 0.26 select count(*) as aggregate from `custom_fields` where `modules_code` = ?
  • 50.13 select `id`, `description`, `access_level`, `type`, `template_id` from `user_groups`


MONGO SERVERS[edit]

Installation[edit]

  • sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
  • sudo apt- get update
  • sudo apt-get install -y mongodb-org

Clients[edit]

  • Robomongo GUI WIN [[1]]

Configuring[edit]

  • mkdir -p /data/db
  • service mongod restart

Throubleshooting[edit]

  • sudo add-apt-repository ppa:ubuntu-toolchain-r/test
  • sudo apt-get update
  • sudo apt-get install gcc-4.8
  • rm /usr/bin/gcc
  • rm /usr/bin/g++
  • ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
  • ln -s /usr/bin/g++-4.8 /usr/bin/g++
  • sudo apt-get install libstdc++6