The issue
On our staging environment; I've got an issue with upgrading.
Migrating Flarum...
Nothing to migrate.
Migrating extension: flarum-suspend
Nothing to migrate.
Migrating extension: flarum-flags
Nothing to migrate.
Migrating extension: fof-user-directory
Nothing to migrate.
Migrating extension: fof-user-bio
Nothing to migrate.
Migrating extension: fof-upload
Nothing to migrate.
Migrating extension: fof-terms
Nothing to migrate.
Migrating extension: fof-stopforumspam
Nothing to migrate.
Migrating extension: fof-recaptcha
Nothing to migrate.
Migrating extension: fof-merge-discussions
Nothing to migrate.
Migrating extension: fof-frontpage
Nothing to migrate.
Migrating extension: fof-analytics
Nothing to migrate.
Migrating extension: flarum-tags
Nothing to migrate.
Migrating extension: flarum-subscriptions
Nothing to migrate.
Migrating extension: flarum-sticky
Nothing to migrate.
Migrating extension: flarum-mentions
In Connection.php line 712:
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `flarumpost_mentions_group` add constraint `flarumpost_mentions_group_post_id_foreign` foreign key (`post_id`) reference
s `flarumposts` (`id`) on delete cascade)
In Exception.php line 18:
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint
In PDOStatement.php line 117:
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint
migrate
I've checked the database but the database are installed correctly.
The table info:
CREATE TABLE `flarumpost_mentions_group` (
`post_id` int(10) unsigned NOT NULL,
`mentions_group_id` int(10) unsigned NOT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`post_id`,`mentions_group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
I've add there: migration: 2022_10_21_000000_create_post_mentions_group_table
extension: flarum-mentions
and after that running migrations is fixed.
So, it looks like all information are ok?
Is the solution to add a new row into the migration-table or is there something i've missed?
Flarum information
php flarum info
Flarum core 1.6.0
PHP version: 8.1.12
MySQL version: 5.7.40-0ubuntu0.18.04.1
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
+-------------------------------------------------+-----------------------+--------+
| Flarum Extensions | | |
+-------------------------------------------------+-----------------------+--------+
| ID | Version | Commit |
+-------------------------------------------------+-----------------------+--------+
| flarum-suspend | v1.6.0 | |
| flarum-flags | v1.6.0 | |
| fof-user-directory | 1.2.3 | |
| fof-user-bio | 1.1.1 | |
| fof-upload | 1.2.3 | |
| fof-terms | 1.2.0 | |
| fof-stopforumspam | 1.2.3 | |
| fof-split | 1.1.0 | |
| fof-recaptcha | 1.1.0 | |
| fof-merge-discussions | 1.3.1 | |
| fof-frontpage | 1.1.0 | |
| fof-formatting | 1.0.2 | |
| fof-analytics | 1.1.0 | |
| flarumite-simple-spoilers | 1.0.0 | |
| flarum-tags | v1.6.0 | |
| flarum-subscriptions | v1.6.0 | |
| flarum-sticky | v1.6.0 | |
| flarum-statistics | v1.6.0 | |
| flarum-mentions | v1.6.0 | |
| flarum-markdown | v1.6.0 | |
| flarum-lock | v1.6.0 | |
| flarum-likes | v1.6.0 | |
| flarum-emoji | v1.6.0 | |
| flarum-bbcode | v1.6.0 | |
| flarum-approval | v1.6.0 | |
+-------------------------------------------------+-----------------------+--------+
Base URL: https://***
Installation path: /home/***/public_html/releases/20
Queue driver: sync
Session driver: file
Mail driver: smtp
Debug mode: off