Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carl Sjöholm 29 posts 220 karma points
    May 08, 2021 @ 07:01
    Carl Sjöholm
    0

    Umbraco Custom Table not added to database

    Hi. I followed the tutorial here:

    https://our.umbraco.com/documentation/extending/database/

    How ever, the TableExists returns true even the table is not in the database.

    [TableName(TableName)]
    [PrimaryKey(nameof(SectionId))]
    [ExplicitColumns]
    public class Section
    {
        public const string TableName = "custom" + nameof(Section);
    
        [Column(nameof(SectionId))]
        [PrimaryKeyColumn]
        public int SectionId { get; set; }
    
        [Column(nameof(Name))]
        public string Name { get; set; }
    }
    

    I can run Create.Table<Section>().Do(); as many times in the migration as I want without it throwing exceptions.

    I installed "Skybrud.Umbraco.Redirects"-package, do I need to continue on that migration for it to work?

  • Huw Reddick 495 posts 1467 karma points
    May 08, 2021 @ 11:26
    Huw Reddick
    100

    Are you seeing any errors in the Umbraco logs that may indicate what is happening, if not maybe try adding some logging to your composer.

    Does you SQL user have the required permission to create the table?

    Do you have access to SQL logs to see if anything in there helps diagnose the problem?

  • Carl Sjöholm 29 posts 220 karma points
    May 08, 2021 @ 17:23
    Carl Sjöholm
    0

    Somehow, despite having a specified connectionstring to my local SQL server. It still takes the sql ce database in the App_Data folder.

    If I remove the database I cannot run the solution.

    Can anyone explain this?

  • Carl Sjöholm 29 posts 220 karma points
    May 08, 2021 @ 17:27
    Carl Sjöholm
    0

    This is fixed. PEBKAC :)

  • Huw Reddick 495 posts 1467 karma points
    May 08, 2021 @ 17:42
    Huw Reddick
    0

    :) glad you sorted it

Please Sign in or register to post replies

Write your reply to:

Draft