Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8162083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:38:00+00:00 2026-06-06T18:38:00+00:00

1 Map has N Images. When a the user updates the Map data I

  • 0

1 Map has N Images. When a the user updates the Map data I do not make an update because then I lose the old data. Thus I do an Insert into the Map table with the same auto incremented Id but a new datetime stamp. This way I want to historize all changes on a Map in the user interface.

Table Map: PK is Id + CreatedAt

 [Id] [int] IDENTITY(1,1) NOT NULL, 
 [CreatedAt] [datetime] NOT NULL,   
 ...

Table Images: PK is Id, FK is MapId + CreatedAt

[Id] [int] IDENTITY(1,1) NOT NULL,
[Image] [varbinary](max) NOT NULL,
[VisibleIndex] [int] NOT NULL,
[CreatedAt] [datetime] NOT NULL,
[MapId] [int] NOT NULL,

If I have a PK with 2 fields my FK must also have 2 fields.

But this does not work in my case because the CreatedAt date from table Images cant be the createdAt date from the table Map.

How would you do the historical “update” ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:38:02+00:00Added an answer on June 6, 2026 at 6:38 pm

    Separate “constant” and “evolvable” aspects of the map into two tables:

    enter image description here

    This assumes you only want to version the map fields but not images.


    If you also want to version images, you could do it like this:

    enter image description here

    When creating a new Map version:

    • For images that didn’t change: just copy the links but don’t create new image versions.
    • For images that did change: create new image versions and links.

    This way, you don’t have to do expensive copying of the image content just because the map has changed. You only create a new image version when the image itself has changed.

    NOTE: This model is a little too general. It allows same images to be shared between multiple maps (not just multiple versions of the same map). Let me know if you’d like to restrict that.


    To make images “private” to the map, you can do something like this:

    enter image description here

    Note how we don’t introduce any surrogate keys. Instead, we let identifying relationships produce “natural” keys, which then get merged at the bottom of the diamond-shaped dependencies: ImageLink.MapId has foreign keys toward both “edges” of the “diamond”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used the Tiled map editor to make a XML file which has items
I have a project that has a requirement of displaying map data in offline
i have a map file which has several tile images in the form of
I am using an IMG Map that has many small pictures. When I hover
I'm looking for an implementation of java.util.Map that has a method that will return
In a controller, I have populated a map that has a string as key
I have an app which has a map and some POI on it. I'm
I'm running a sample application that has a map component to it. The app
I've got an app that has a map with pins for locations, but I
I need to map a class which has a list of Enums to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.