Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Migrations: sections and single page error on migrate/up with blank uriFormat #2525

Closed
skramstad opened this issue Mar 4, 2018 · 1 comment

Comments

@skramstad
Copy link

Description

When running ./craft migrate/up with this code and uriFormat is blank for homepage. It fails to run the migration. Setting null does not work either. However if I set something random in the uriFormat field it works.

Is this a bug or am I missing something?

Thanks!

Error message below:

   *** failed to apply m180304_095011_entry_homepage (time: 0.021s)
   0 from 1 migrations were applied.
  Migration failed. The rest of the migrations are canceled.

Migration:

    // Get the primary site ID
    $siteId = Craft::$app->sites->getPrimarySite()->id;

    //
    // Create Home
    //
    $homepage = new Section([
        'name' => 'Home',
        'handle' => 'homepage',
        'enableVersioning' => 1,
        'type' => 'single',
        'siteSettings' => [
            new Section_SiteSettings([
                'siteId' => $siteId,
                'uriFormat' => '',
                'template' => 'index',
                'hasUrls' => 1,
            ])
        ]
    ]);

    return Craft::$app->sections->saveSection($homepage);

Steps to reproduce

  1. Create a new migration with migrate/create
  2. Insert this code
  3. ./craft migrate/up

Additional info

  • Craft version: Craft Pro 3.0.0-RC13
  • PHP version: 7.0.25
  • Database driver & version: MySQL 5.7.21
@brandonkelly
Copy link
Member

If you want the single to be the homepage, you must set its uriFormat to __home__.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants