...nice way to write strings that span multiple lines. Note that this example uses MySQL. Refer to this card if you use PostgreSQL. If you need more than one JOIN...
Enabling this shows each column in a own line. It's similar to mysql \G \x on Prevent users FROM connecting to a database ALTER DATABASE foo_db CONNECTION...
...support nested transaction, this behaviour will be simulated with Savepoints (this is done for MySQL and Postgres). If a custom transaction lives inside another transaction, which we can not control...
...AJAX request completes before launching the debugger. A starved server thread can cause unexpected MySQL deadlocks. E.g. your test triggers a server request, locks some rows (MySQL automatically locks rows...
...starves the server thread. If you now run a query on the locked table, MySQL will explode with a detected deadlock. Again you need to wait_until the AJAX request...
...engineering of your source code you might consider adding a comment. Both PostgreSQL and MySQL support comments in the DB schema: For new columns: https://guides.rubyonrails.org/active_record_migrations.html#comments Changing the comment...
...will make a single query. It uses a sub-query, which is slow in MySQL, but fast in PostgreSQL: SELECT * FROM posts WHERE user_id IN (SELECT id FROM users...
...invoice.products # => [# ] How the :uniq option works In the example above it changes the MySQL query for Invoice#products to something like SELECT DISTINCT * FROM products ... Issues with PostgreSQL
...rake db:migrate" on an empty # database, we swallow such errors. end end For MySQL, rescue Mysql2::Error, ActiveRecord::StatementInvalid might be fitting...
See also PostgreSQL: Difference between text and varchar columns Text column sizes in MySQL
...mix dates and times incomparisons, mind to not compare datetimes with date ranges in MySQL. Visualisation 1. ------- ------- AAA AAA BBB BBB ------- ------- 2. ------- AAA B ------- 3. ------- A BBB ------- 4. ------- AAA
This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the ActiveRecord ORM used with Ruby on Rails, but the techniques...
...always use Time.current instead of Time.now, etc. Why? Because of the way Rails and MySQL deal with time zones you would need to take care to use Time.zone.now in projects...
...because those times will also be converted using to_s(:db) and sent to MySQL. The database itself does not care about the (longer) value and just stores the date...
Tod is a gem for working with daytimes. That's a tuple of (hour, minute second) without a day, month...
PostgreSQL, unlike MySQL, treats strings as case sensitive in all circumstances. This includes comparison with = and LIKE collision detection in unique indexes Usually this is fine, but some strings (like...
...not found", "Can't open file or directory", ...) after configuration changes, e.g. when changing MySQL's data directory. Remember to have a look at AppArmor's daemon configuration (usually at...
...with both old and new Rails applications. Switch to MariaDB Remove MySQL: sudo apt remove mysql-common mysql-client mysql-server mysql-apt-config Install MariaDB: sudo apt install mariadb...
The mysql and mysql2 gems installed on your machine are still built against the mysql-client package you just uninstalled, so you will probably get this error when booting...
...will make ActiveRecord join the notes and authors tables and the query will fail: Mysql::Error: Column 'created_at' in order clause is ambiguous Unless you have a test covering...
...id: Post.distinct_on_user.pluck(:user_id)).order(...) Further ressources There are some good examples on the MySql documentation to produce queries with the same result in the article 5.6.4 The Rows Holding...
...Nummern und Protokolle der häufigsten Services auswendig: SSH, DNS, HTTP, HTTPS, SMTP, POP3, IMAP, MySQL, PostgreSQL, Redis Wie kann ich prüfen, ob ein Service erreichbar ist? Wie kann ich alle...
Das Standardtool für Monitoring auf AWS ist Cloudwatch. Du hast dir in den AWS Kapiteln Cloudwatch sicherlich schon grundsätzlich angesehen...
$ mariabackup --prepare --target-dir ./mariabackup $ mariabackup --move-back --target-dir ./mariabackup # chown -R mysql:mysql /var/lib/mysql/ # systemctl start mariadb
...Database Service (RDS) ist ein vollständig verwalteter Dienst, um unterschiedliche relationale Datenbanken wie z.B. MySQL, MariaDB, PostgreSQL oder Oracle zu betreiben. Dabei sind Replikation, Backups und Failover bereits gelöst.
...public | pages | 3919 Please note that this does not work reliably on database slaves. MySQL SELECT table_name, table_rows FROM information_schema.tables WHERE table_schema = (SELECT database()) ORDER BY table...