Git Product home page Git Product logo

Comments (9)

phillmorgan28 avatar phillmorgan28 commented on May 28, 2024 2

Ok thanks, that's quite a job. For anyone that want's a nice quick and easy way to do that, adjust this to your needs and run

#!/bin/bash

# Get a list of all databases
databases=$(mysql -u your_username -p'your_password' -e 'SHOW DATABASES;' | grep -Ev 'Database|information_schema|performance_schema|mysql')

# Loop through each database
for db in $databases; do
    # Get a list of all tables in the current database
    tables=$(mysql -u your_username -p'your_password' $db -e 'SHOW TABLES;' | grep -v 'Tables_in_')

    # Loop through each table
    for table in $tables; do
        # Execute the ALTER TABLE command, quoting table names with backticks
        mysql -u your_username -p'your_password' $db -e "ALTER TABLE \`$table\` ROW_FORMAT=DYNAMIC;"
    done
done

from postal.

arnebr avatar arnebr commented on May 28, 2024

It seems the initial error was different:

== 20240214132253 AddLockFieldsToWebhookRequests: migrating ===================
-- add_column(:webhook_requests, :locked_by, :string)
   -> 0.0105s
-- add_column(:webhook_requests, :locked_at, :datetime, {:precision=>nil})
   -> 0.0147s
-- add_index(:webhook_requests, :locked_by)
rake aborted!
StandardError: An error has occurred, all later migrations canceled: (StandardError)

Mysql2::Error: Index column size too large. The maximum column size is 767 bytes
/usr/local/bundle/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `_query'
/usr/local/bundle/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `block in query'
/usr/local/bundle/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `handle_interrupt'
/usr/local/bundle/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `query'
/usr/local/bundle/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:638:in `block (2 levels) in raw_execute'
/usr/local/bundle/gems/activesupport-7.0.8.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'

from postal.

adamcooke avatar adamcooke commented on May 28, 2024

What version of MySQL/MariaDB are you using?

from postal.

arnebr avatar arnebr commented on May 28, 2024

MariaDB 10.6.16 - that seems to be the issue. Upgrading right now.

from postal.

arnebr avatar arnebr commented on May 28, 2024

Upgraded to 11.2.1:
== 20240223141500 AddTwoFactorRequiredToSessions: migrating ===================
Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

from postal.

arnebr avatar arnebr commented on May 28, 2024

ALTER TABLE authie_sessions ROW_FORMAT=DYNAMIC;
Fixed the problem

from postal.

adamcooke avatar adamcooke commented on May 28, 2024

Glad you got this sorted.

I have added a note to the upgrade page to note that people do need to be aware of the row format on their tables before upgrading.

https://docs.postalserver.io/getting-started/upgrade-to-v3#database-considerations

from postal.

phillmorgan28 avatar phillmorgan28 commented on May 28, 2024

The docs state "It is important that any pre-existing tables in your database are set up with the DYNAMIC row format." .. does this include all of the postal-server-X databases as well, or just the main postal db?

from postal.

adamcooke avatar adamcooke commented on May 28, 2024

I'd recommend making sure all tables in all databases are set like that to avoid any potential issue in the future.

from postal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.