Skip to content

deploy: Migrations no longer run successfully from scratch since rails 8.1. #236

@jnms-me

Description

@jnms-me

On an empty mariadb 11.8 database, tap won't start with this error:

tap_1  | database: tap
tap_1  | Current version: 0
tap_1  |
tap_1  | bin/rails aborted!
tap_1  | ActiveRecord::MismatchedForeignKey: Column `product_id` on table `barcodes` does not match column `id` on `products`, which has type `bigint(20)`. To resolve this issue, change the type of the `product_id` column on `barcodes` to be :bigint. (For example `t.bigint :product_id`). (ActiveRecord::MismatchedForeignKey)
tap_1  | Original message: Mysql2::Error: Can't create table `tap`.`barcodes` (errno: 150 "Foreign key constraint is incorrectly formed")
tap_1  | /tap/db/schema.rb:90:in 'block in <main>'
tap_1  | /tap/db/schema.rb:13:in '<main>'
tap_1  |
tap_1  | Caused by:
tap_1  | ActiveRecord::MismatchedForeignKey: There is a mismatch between the foreign key and primary key column types. Verify that the foreign key column type and the primary key of the associated table match types. (ActiveRecord::MismatchedForeignKey)
tap_1  | Original message: Mysql2::Error: Can't create table `tap`.`barcodes` (errno: 150 "Foreign key constraint is incorrectly formed")
tap_1  | /tap/db/schema.rb:90:in 'block in <main>'
tap_1  | /tap/db/schema.rb:13:in '<main>'
tap_1  |
tap_1  | Caused by:
tap_1  | Mysql2::Error: Can't create table `tap`.`barcodes` (errno: 150 "Foreign key constraint is incorrectly formed") (Mysql2::Error)
tap_1  | /tap/db/schema.rb:90:in 'block in <main>'
tap_1  | /tap/db/schema.rb:13:in '<main>'
tap_1  | Tasks: TOP => db:prepare
tap_1  | (See full trace by running task with --trace)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions