问:
Meta-annotation breaks when upgrade from SpringBoot 3.0.0 to 3.0.1
I am using SpringBoot 3.0.0 with springdoc-openapi-starter-webmvc-ui 2.0.2. I have a annotation to be used with RestController methods:

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Configuration and description of a endpoint.
 */
@ApiResponses
@Operation
@RequestMapping
@Target(ElementType.METHOD)
@Retention(RUNTIME)
@Documented
public @interface HorusEndpoint {

    // other attributes

    /**
     * @return the array of the ApiResponses
     * @see ApiResponses#value()
     */
    @AliasFor(annotation = ApiResponses.class, attribute = "value")
    ApiResponse[] responses() default {};

}
```

It works well in SpringBoot 3.0.0.
However, I tried to upgrade to SpringBoot 3.0.1. When I start my application I had this error message:

org.springframework.beans.factory.BeanDefinitionStoreException: Failed
to read candidate component class: file
[C:\projects\horus\horus-back\user-management\target\classes\com\capgemini\engineering\horus\usermanagement\controllers\CollaboratorController.class]

...

Caused by:
org.springframework.core.annotation.AnnotationConfigurationException:
@AliasFor declaration on attribute 'responses' in annotation
[com.capgemini.engineering.horus.common.controllers.HorusEndpoint]
declares an alias for attribute 'value' in annotation
[io.swagger.v3.oas.annotations.responses.ApiResponses] which is not
meta-present.

I still tried to check if there was any difference in the annotation ApiResponses from SpringBoot 3.0.0 to 3.0.1. However both use the version (swagger-annotations-jakarta, version 2.7.7). I Still tried change the springdoc-openapi-starter-webmvc-ui version from 2.0.2 to 2.0.0, but I got the same message.

I google for this kind of message and I found this: Spring aliasFor for Annotations with Target(PARAMETER) . However, I am not sure if the presented solution applies to my case. They use a HandlerMethodArgumentResolver that, if I understtod correctly, works for annotations  which target is ElementType.PARAMETER while my annotation is ElementType.METHOD. I took a look at org.springframework.web.method.support package (that is where HandlerMethodArgumentResolver is located) and I didn't find anything that could fit what I needed. i.e. an handler for methods, instead for parameters for these methods.

May be this can be a bug? why this error after a small version change?

Thanks,

Rafael Afonso

Body:
I am using SpringBoot 3.0.0 with springdoc-openapi-starter-webmvc-ui 2.0.2. I have a annotation to be used with RestController methods:

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Configuration and description of a endpoint.
 */
@ApiResponses
@Operation
@RequestMapping
@Target(ElementType.METHOD)
@Retention(RUNTIME)
@Documented
public @interface HorusEndpoint {

    // other attributes

    /**
     * @return the array of the ApiResponses
     * @see ApiResponses#value()
     */
    @AliasFor(annotation = ApiResponses.class, attribute = "value")
    ApiResponse[] responses() default {};

}

It works well in SpringBoot 3.0.0.
However, I tried to upgrade to SpringBoot 3.0.1. When I start my application I had this error message:

org.springframework.beans.factory.BeanDefinitionStoreException: Failed
to read candidate component class: file
[C:\projects\horus\horus-back\user-management\target\classes\com\capgemini\engineering\horus\usermanagement\controllers\CollaboratorController.class]

...

Caused by:
org.springframework.core.annotation.AnnotationConfigurationException:
@AliasFor declaration on attribute 'responses' in annotation
[com.capgemini.engineering.horus.common.controllers.HorusEndpoint]
declares an alias for attribute 'value' in annotation
[io.swagger.v3.oas.annotations.responses.ApiResponses] which is not
meta-present.

I still tried to check if there was any difference in the annotation ApiResponses from SpringBoot 3.0.0 to 3.0.1. However both use the version (swagger-annotations-jakarta, version 2.7.7). I Still tried change the springdoc-openapi-starter-webmvc-ui version from 2.0.2 to 2.0.0, but I got the same message.

I google for this kind of message and I found this: Spring aliasFor for Annotations with Target(PARAMETER) . However, I am not sure if the presented solution applies to my case. They use a HandlerMethodArgumentResolver that, if I understtod correctly, works for annotations  which target is ElementType.PARAMETER while my annotation is ElementType.METHOD. I took a look at org.springframework.web.method.support package (that is where HandlerMethodArgumentResolver is located) and I didn't find anything that could fit what I needed. i.e. an handler for methods, instead for parameters for these methods.

May be this can be a bug? why this error after a small version change?

Thanks,

Rafael Afonso


来源: stackexchange

问:
Django model: OperationalError: no such column: home_atliktas_darbas.bendrija_id, help fix, Django version 3.2
I am creating a model that is related to other one, meaning the model I am trying to create can't exist if the model its related to does not exist.
now I am new to django (just a few months), but I have created models with the same concept and had no issues before, this is the first time this has happened and I have no idea what could be the cause

this is the model its related to

```<code>class Bendrija(models.Model):

    class Meta:
        verbose_name_plural = 'Bendrijos'

    name = models.CharField(max_length=254)
    address = models.CharField(max_length=254, null=True, blank=True)

    def __str__(self):
        return self.name
</code>```

and this is the model I want to create

```<code>class Atliktas_Darbas(models.Model):

    class Meta:
        verbose_name_plural = 'Atlikti Darbai'

    bendrija = models.ForeignKey(Bendrija, on_delete=models.CASCADE,
                                 related_name="atliktas_darbas")
    pavadinimas = models.CharField(max_length=254)
    aprasymas = models.CharField(max_length=254, null=True, blank=True)
    preliminari_kaina = models.CharField(max_length=254)
    galutine_kaina = models.CharField(max_length=254, null=True, blank=True)
    atlikti_iki = models.DateField()
    darbas_atlikas = models.DateField(null=True, blank=True)
    pastabos = models.CharField(max_length=254, null=True, blank=True)

    def __str__(self):
        return self.pavadinimas
</code>```

first I thought I forgot to add "bendrija' (the model field) to list_display in admin.py and I was correct thinking that fixed it I thought I was done, but I was wrong, after that I tried a bunch of stuff, but nothing worked

ContentLicense: CC BY-SA 4.0

Body:
I am creating a model that is related to other one, meaning the model I am trying to create can't exist if the model its related to does not exist.
now I am new to django (just a few months), but I have created models with the same concept and had no issues before, this is the first time this has happened and I have no idea what could be the cause

this is the model its related to

class Bendrija(models.Model):

    class Meta:
        verbose_name_plural = 'Bendrijos'

    name = models.CharField(max_length=254)
    address = models.CharField(max_length=254, null=True, blank=True)

    def __str__(self):
        return self.name

and this is the model I want to create

class Atliktas_Darbas(models.Model):

    class Meta:
        verbose_name_plural = 'Atlikti Darbai'

    bendrija = models.ForeignKey(Bendrija, on_delete=models.CASCADE,
                                 related_name="atliktas_darbas")
    pavadinimas = models.CharField(max_length=254)
    aprasymas = models.CharField(max_length=254, null=True, blank=True)
    preliminari_kaina = models.CharField(max_length=254)
    galutine_kaina = models.CharField(max_length=254, null=True, blank=True)
    atlikti_iki = models.DateField()
    darbas_atlikas = models.DateField(null=True, blank=True)
    pastabos = models.CharField(max_length=254, null=True, blank=True)

    def __str__(self):
        return self.pavadinimas

first I thought I forgot to add "bendrija' (the model field) to list_display in admin.py and I was correct thinking that fixed it I thought I was done, but I was wrong, after that I tried a bunch of stuff, but nothing worked


问:
Get highest result from database query
I'm creating a Pokédex command for discord.js v14 which pulls data from my MySQL table I have hosted on my website.

It's working, but the database contains several rows for specific Pokémon (because changes in later generations) and I want the command to read the highest generation row.

Currently I've the following (where "slug" is the Pokémon and "gen" is the generation):

```<code>    // functions
    function queryData(slug, tableName) {
      return new Promise((md) => {
        con.query(
          `SELECT * FROM ${tableName}`,
          function (error, results, fields) {
            if (error) console.log(error);
            return md(
              results.filter((t) => t.slug.toLowerCase() == slug.toLowerCase())
            );
          }
        );
      });
    }

    // parse
    const slug = interaction.options.getString("pokedex");

    // query db
    const data = (await queryData(slug.replace(" ", "-"), "pokemon"))[0];
    if (data.length > 1) data = data.filter((t) => t.gen != 10);
</code>```

I have for example Dewgong with a row for gen10 and gen20, and the command should get the gen20 row as this is the highest value:

How should I proceed?

EDIT

This seemed to do the trick:

con.query(
SELECT * FROM ${tableName} WHERE (slug,gen) IN  ( SELECT slug, MAX(gen) FROM pokemon GROUP BY slug ),

Title: Get highest result from database query

Body:
I'm creating a Pokédex command for discord.js v14 which pulls data from my MySQL table I have hosted on my website.

It's working, but the database contains several rows for specific Pokémon (because changes in later generations) and I want the command to read the highest generation row.

Currently I've the following (where "slug" is the Pokémon and "gen" is the generation):

    // functions
    function queryData(slug, tableName) {
      return new Promise((md) => {
        con.query(
          `SELECT * FROM ${tableName}`,
          function (error, results, fields) {
            if (error) console.log(error);
            return md(
              results.filter((t) => t.slug.toLowerCase() == slug.toLowerCase())
            );
          }
        );
      });
    }

    // parse
    const slug = interaction.options.getString("pokedex");

    // query db
    const data = (await queryData(slug.replace(" ", "-"), "pokemon"))[0];
    if (data.length > 1) data = data.filter((t) => t.gen != 10);

I have for example Dewgong with a row for gen10 and gen20, and the command should get the gen20 row as this is the highest value:

How should I proceed?

EDIT

This seemed to do the trick:

con.query(
SELECT * FROM ${tableName} WHERE (slug,gen) IN  ( SELECT slug, MAX(gen) FROM pokemon GROUP BY slug ),


问:
Load new data post once refresh page in Flutter
I need to refresh page in news page articles in my Flutter app, once pull to refresh new articles have to upload, in this case using the code below, What should I add or edit to add this function?</p>
```<code>class ApiNewsPage {
  final String url = newsJsonLink; // Link news
  Future<List?> getNewsArticles() async {
    String nameDB = "articledata.json";
    var dir = await getTemporaryDirectory();

    File file = File(dir.path + "/" + nameDB);

    if(file.existsSync()) {
      print("Loading Articles from cache");
      var jsonDB = file.readAsStringSync();
      List response = json.decode(jsonDB);
      return response;
    } else {
        var response = await http.get(Uri.parse(url));

        if (response.statusCode == 200) {
          //await File(nameDB).exists();
          var jsonResponse = response.body;
          List newArticles = json.decode(jsonResponse);
          //File(nameDB).deleteSync(recursive: true);
          /// save json in local file
          file.writeAsStringSync(jsonResponse, flush: true, mode: FileMode.write);
          print("Fetching new articles from internet");
          return newArticles;
        }
    }
  }
}```
</code>```

Body:
I need to refresh page in news page articles in my Flutter app, once pull to refresh new articles have to upload, in this case using the code below, What should I add or edit to add this function?

class ApiNewsPage {
  final String url = newsJsonLink; // Link news
  Future<List?> getNewsArticles() async {
    String nameDB = "articledata.json";
    var dir = await getTemporaryDirectory();

    File file = File(dir.path + "/" + nameDB);

    if(file.existsSync()) {
      print("Loading Articles from cache");
      var jsonDB = file.readAsStringSync();
      List response = json.decode(jsonDB);
      return response;
    } else {
        var response = await http.get(Uri.parse(url));

        if (response.statusCode == 200) {
          //await File(nameDB).exists();
          var jsonResponse = response.body;
          List newArticles = json.decode(jsonResponse);
          //File(nameDB).deleteSync(recursive: true);
          /// save json in local file
          file.writeAsStringSync(jsonResponse, flush: true, mode: FileMode.write);
          print("Fetching new articles from internet");
          return newArticles;
        }
    }
  }
}```


问:
TypeError: createSlice is not a function from vitest
I am building a tic-tac-toe game in react with redux and trying to use vitest for testing. I have setup board slice and the store but when trying to run my first test i get the error below

```<code>⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/slices/board/reducers/updateMoveReducer.test.js [ src/slices/board/reducers/updateMoveReducer.test.js ]
TypeError: createSlice is not a function
 ❯ src/slices/board/board.js:11:20
      9| };
     10|
     11| const boardSlice = createSlice({
       |                    ^
     12|  name: 'board',
     13|  initialState,
 ❯ src/slices/board/reducers/updateMoveReducer.test.js:1:31

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

 Test Files  1 failed (1)
      Tests  no tests
   Start at  13:36:13
   Duration  1.27s (transform 371ms, setup 0ms, collect 0ms, tests 0ms)
</code>```

Here is my gameStore code

import boardReducer from './slices/board/board';
import { configureStore } from '@reduxjs/toolkit';

export const gameStore = configureStore({
    reducer: {
        board: boardReducer,
    },
});

```
<p>Here is the board slice</p>
<pre class="lang-js prettyprint-override"><code>import { createSlice } from '@reduxjs/toolkit';
import { updateMoveReducer } from './reducers/updateMoveReducer';
const initialState = {
    tiles: [
        [undefined, undefined, undefined],
        [undefined, undefined, undefined],
        [undefined, undefined, undefined],
    ],
};

const boardSlice = createSlice({
    name: 'board',
    initialState,
    reducers: {
        updateMove: updateMoveReducer,
    },
});

export const { updateMove } = boardSlice.actions;
export default boardSlice.reducer;

</code>```

Here is the updateMoveReducer currently.

export const updateMoveReducer = (state, action) => {
    return state;
};

```
<p>I have the store setup with Provider in the app and can see that the slice is setup correctly when using the redux chrome dev tool.</p>
<p>redux chrome dev tool screenshot</p>
<p>tried running the following test that gave the error.</p>
<pre class="lang-js prettyprint-override"><code>import { updateMove } from '../board';
import { gameStore } from '../../../gameState';
import { expect, it, describe } from 'vitest';

describe('updateMoveReducer', () => {
    it('should update the tiles array with the move', () => {
        const player = 'x';
        const move = { x: 0, y: 0 };
        gameStore.dispatch(updateMove({ player, move }));
        const state = gameStore.getState().board;
        expect(state.tiles[move.x][move.y]).toBe(player);
    });
});

</code>```

Body:
I am building a tic-tac-toe game in react with redux and trying to use vitest for testing. I have setup board slice and the store but when trying to run my first test i get the error below

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/slices/board/reducers/updateMoveReducer.test.js [ src/slices/board/reducers/updateMoveReducer.test.js ]
TypeError: createSlice is not a function
 ❯ src/slices/board/board.js:11:20
      9| };
     10|
     11| const boardSlice = createSlice({
       |                    ^
     12|  name: 'board',
     13|  initialState,
 ❯ src/slices/board/reducers/updateMoveReducer.test.js:1:31

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

 Test Files  1 failed (1)
      Tests  no tests
   Start at  13:36:13
   Duration  1.27s (transform 371ms, setup 0ms, collect 0ms, tests 0ms)

Here is my gameStore code

import boardReducer from './slices/board/board';
import { configureStore } from '@reduxjs/toolkit';

export const gameStore = configureStore({
    reducer: {
        board: boardReducer,
    },
});

Here is the board slice

import { createSlice } from '@reduxjs/toolkit';
import { updateMoveReducer } from './reducers/updateMoveReducer';
const initialState = {
    tiles: [
        [undefined, undefined, undefined],
        [undefined, undefined, undefined],
        [undefined, undefined, undefined],
    ],
};

const boardSlice = createSlice({
    name: 'board',
    initialState,
    reducers: {
        updateMove: updateMoveReducer,
    },
});

export const { updateMove } = boardSlice.actions;
export default boardSlice.reducer;

Here is the updateMoveReducer currently.

export const updateMoveReducer = (state, action) => {
    return state;
};

I have the store setup with Provider in the app and can see that the slice is setup correctly when using the redux chrome dev tool.

redux chrome dev tool screenshot

tried running the following test that gave the error.

import { updateMove } from '../board';
import { gameStore } from '../../../gameState';
import { expect, it, describe } from 'vitest';

describe('updateMoveReducer', () => {
    it('should update the tiles array with the move', () => {
        const player = 'x';
        const move = { x: 0, y: 0 };
        gameStore.dispatch(updateMove({ player, move }));
        const state = gameStore.getState().board;
        expect(state.tiles[move.x][move.y]).toBe(player);
    });
});


问:
How to use ErrorHandlingResultCallback of mongo in java
The below code is used to insert a document in MongoDB. the issue is with this is that even if it due to some errors the transaction didn't happen. still, the logger inserted will be printed.

```<code>collection.insertOne(insertableDocument, (SingleResultCallback<Void>) new SingleResultCallback<Void>() {
            @Override
            public void onResult(final Void result, final Throwable t) {
                logger.info("Inserted!");
            }
        });
</code>```

There is one other way to do make sure to see the error and all this works:

```<code>collection.insertOne(insertableDocument, (SingleResultCallback<Void>) new SingleResultCallback<Void>() {
            @Override
            public void onResult(final Void result, final Throwable t) {

             if(throwable!=null){
                    logger.error("Object not inserted due to error " +t.getMessage());

                }else {
                    logger.info("Inserted!");
                }

            }
        });

</code>```

I want to perform the second example ErrorHandlingResultCallback class in package com.mongodb.internal.async.

Body:
The below code is used to insert a document in MongoDB. the issue is with this is that even if it due to some errors the transaction didn't happen. still, the logger inserted will be printed.

collection.insertOne(insertableDocument, (SingleResultCallback<Void>) new SingleResultCallback<Void>() {
            @Override
            public void onResult(final Void result, final Throwable t) {
                logger.info("Inserted!");
            }
        });

There is one other way to do make sure to see the error and all this works:

collection.insertOne(insertableDocument, (SingleResultCallback<Void>) new SingleResultCallback<Void>() {
            @Override
            public void onResult(final Void result, final Throwable t) {

             if(throwable!=null){
                    logger.error("Object not inserted due to error " +t.getMessage());

                }else {
                    logger.info("Inserted!");
                }

            }
        });

I want to perform the second example ErrorHandlingResultCallback class in package com.mongodb.internal.async.


问:
woocommmerce filter by attribute is not working with my custom code
I'm working on a wordpress plugin,there is a menu at the top of the site AND a woocommerce widget called filter by gender

Top Menu

The top menu contain the following

fluid women men

Woocommerce Filter by gender (Widget)

This contains two links as

men

women

The WooCommerce Filter by Gender filter selection should always reflect the same
state as the session, across all pages

If the user changes the selection in the top menu, the WooCommerce filter should update accordingly   -----> this is working

Not working scenario

Let say in top menu men is selected, so in woocommerce filter men will be selected, but when a user try to select women from the woocommerce filter then the filter is not updating and it is on the previous selection that was men

I'm using the following code

When user clicks on women in top men I'm doing this

```<code>$('#menu-item-12689 a').click(function(e){ // FEMALE
        e.preventDefault();

        $('#menu-item-12689 a').css({'background-color':'#000','color':'#fff'});
        $('#menu-item-12690 a').css({'background-color':'','color':''});
        $('#menu-item-11829 a').css({'background-color':'','color':''});

        $.ajax({
            data:{action:'secookieta',gender:'women'},
            method:'POST',
            url: ajaxurl,
            success:function(data){
                console.log('Gender set');
                console.log('the gender is '+data);
                toastr.success('Gender set as female.');
                $('#woocommerce_layered_nav-6 > ul:nth-child(2) > li:nth-child(2) > a:nth-child(1)').click();

                window.location.reload();

            }
        });
    });
</code>```

Php callback

```<code>add_action('wp_ajax_secookieta','setcookieta');
add_action('wp_ajax_nopriv_secookieta','setcookieta');

// fire on click
function setcookieta(){

 session_start();
 $_SESSION['the_gender'] = $_REQUEST['gender'];
 die();

}
</code>```

On init I'm getting the session value and assign it to the woocommerce filter like

```<code>add_action('init','set_the_filter_gender',1);

function set_the_filter_gender(){
  session_start();
  if(isset($_SESSION['the_gender']) && $_SESSION['the_gender']!='fluid') {
     $_GET['filter_gender'] = $_SESSION['the_gender'];
     $_REQUEST['filter_gender'] = $_SESSION['the_gender'];
   }
 }
</code>```

What I want

When a user try to update the woocommerce filter it should update accordingly,right now it's not updating and it returns the old value it has, what should I do?
Here is a small video of when women is clicked, it does not update the filter
https://www.loom.com/share/8a2e8077dfdb47a7b171d16ae0bdc5c8

Please help, as I can't figure this out
thanks

Body:
I'm working on a wordpress plugin,there is a menu at the top of the site AND a woocommerce widget called filter by gender

Top Menu

The top menu contain the following

fluid women men

Woocommerce Filter by gender (Widget)

This contains two links as

men

women

The WooCommerce Filter by Gender filter selection should always reflect the same
state as the session, across all pages

If the user changes the selection in the top menu, the WooCommerce filter should update accordingly   -----> this is working

Not working scenario

Let say in top menu men is selected, so in woocommerce filter men will be selected, but when a user try to select women from the woocommerce filter then the filter is not updating and it is on the previous selection that was men

I'm using the following code

When user clicks on women in top men I'm doing this

$('#menu-item-12689 a').click(function(e){ // FEMALE
        e.preventDefault();

        $('#menu-item-12689 a').css({'background-color':'#000','color':'#fff'});
        $('#menu-item-12690 a').css({'background-color':'','color':''});
        $('#menu-item-11829 a').css({'background-color':'','color':''});

        $.ajax({
            data:{action:'secookieta',gender:'women'},
            method:'POST',
            url: ajaxurl,
            success:function(data){
                console.log('Gender set');
                console.log('the gender is '+data);
                toastr.success('Gender set as female.');
                $('#woocommerce_layered_nav-6 > ul:nth-child(2) > li:nth-child(2) > a:nth-child(1)').click();

                window.location.reload();

            }
        });
    });

Php callback

add_action('wp_ajax_secookieta','setcookieta');
add_action('wp_ajax_nopriv_secookieta','setcookieta');

// fire on click
function setcookieta(){

 session_start();
 $_SESSION['the_gender'] = $_REQUEST['gender'];
 die();

}

On init I'm getting the session value and assign it to the woocommerce filter like

add_action('init','set_the_filter_gender',1);

function set_the_filter_gender(){
  session_start();
  if(isset($_SESSION['the_gender']) && $_SESSION['the_gender']!='fluid') {
     $_GET['filter_gender'] = $_SESSION['the_gender'];
     $_REQUEST['filter_gender'] = $_SESSION['the_gender'];
   }
 }

What I want

When a user try to update the woocommerce filter it should update accordingly,right now it's not updating and it returns the old value it has, what should I do?
Here is a small video of when women is clicked, it does not update the filter
https://www.loom.com/share/8a2e8077dfdb47a7b171d16ae0bdc5c8

Please help, as I can't figure this out
thanks


问:
Auto reconnect Blazor with custom components-reconnect-modal
According to the following links:
Auto reconnect Blazor Serverside
https://github.com/dotnet/aspnetcore/issues/10325#issuecomment-537979717

one way to auto reconnect to a Blazor server-side page is to refresh the page when it detects that a reconnection is needed. This is accomplished by adding a MutationObserver class in javascript to monitor when the Blazor component displays the message when it tries to reconnect. When this happens, Blazor puts the components-reconnect-modal as visible and then displays a message with a link to reload. So to monitor this, we have to check something like:

```<code>if (document.querySelector('#components-reconnect-modal h5 a')) {
</code>```

It works perfectly when I don't customize the messages involved that Blazor uses when it tries to reconnect, when the connection failed or the connection was rejected. But when I customize the messages (via adding a div with class name = components-reconnect-modal, and modifying the CSS), the document.querySelector function does not find the message.

Obviously I replace the component to search for my customized id message, but it is not working. Does someone have an example of how to use querySelector with a customized components-reconnect-modal block?

For the customization I used the instructions specified in: https://www.syncfusion.com/faq/blazor/general/how-can-i-show-a-custom-message-when-a-customers-connection-is-lost-with-the-server

It works just fine and it shows the messages I wanted. But when I mix this with the code to detect when the message is being shown, querySelector doesn't seem to find it. I tried searching for #components-reconnect-modal,  .components-reconnect-show, #components-reconnect-modal.show, .my-reconnect-modal, .my-reconnect-modal.show to no avail.

The weird part is that when debugging I manually call the document.querySelector with the correct class/component and it returns what is expected (an object, not null), but when running the site without debugging it does not work, so the refresh is not triggered.

Body:
According to the following links:
Auto reconnect Blazor Serverside
https://github.com/dotnet/aspnetcore/issues/10325#issuecomment-537979717

one way to auto reconnect to a Blazor server-side page is to refresh the page when it detects that a reconnection is needed. This is accomplished by adding a MutationObserver class in javascript to monitor when the Blazor component displays the message when it tries to reconnect. When this happens, Blazor puts the components-reconnect-modal as visible and then displays a message with a link to reload. So to monitor this, we have to check something like:

if (document.querySelector('#components-reconnect-modal h5 a')) {

It works perfectly when I don't customize the messages involved that Blazor uses when it tries to reconnect, when the connection failed or the connection was rejected. But when I customize the messages (via adding a div with class name = components-reconnect-modal, and modifying the CSS), the document.querySelector function does not find the message.

Obviously I replace the component to search for my customized id message, but it is not working. Does someone have an example of how to use querySelector with a customized components-reconnect-modal block?

For the customization I used the instructions specified in: https://www.syncfusion.com/faq/blazor/general/how-can-i-show-a-custom-message-when-a-customers-connection-is-lost-with-the-server

It works just fine and it shows the messages I wanted. But when I mix this with the code to detect when the message is being shown, querySelector doesn't seem to find it. I tried searching for #components-reconnect-modal,  .components-reconnect-show, #components-reconnect-modal.show, .my-reconnect-modal, .my-reconnect-modal.show to no avail.

The weird part is that when debugging I manually call the document.querySelector with the correct class/component and it returns what is expected (an object, not null), but when running the site without debugging it does not work, so the refresh is not triggered.


问:
How to add spacing in px to date format
I have the following countdown code that displays the month, days, hours and seconds.
This line I can add extra spaces, but i'm wanting to control it by using px.
$text = $interval->format('%a   %H   %I   %S');

I've tried adding in a span etc but doesn't work.

```<code>`
</code>```
```<code>        $image = imagecreatefrompng('images/countdown-timer-clock-counter-flip-timer-vector-20962384.png');
        ;
        $text = $interval->format('%a   %H   %I   %S');
        imagettftext ($image , $font['size'] , $font['angle'] , $font['x-offset'] , $font['y-offset'] , $font['color'] , $font['file'], $text );
        ob_start();
        imagegif($image);
        $frames[]=ob_get_contents();
        $delays[]=$delay;
        $loops = 0;
        ob_end_clean();
</code>```
```<code>`
</code>```

Title: How to add spacing in px to date format

Body:
I have the following countdown code that displays the month, days, hours and seconds.
This line I can add extra spaces, but i'm wanting to control it by using px.
$text = $interval->format('%a   %H   %I   %S');

I've tried adding in a span etc but doesn't work.

`

        $image = imagecreatefrompng('images/countdown-timer-clock-counter-flip-timer-vector-20962384.png');
        ;
        $text = $interval->format('%a   %H   %I   %S');
        imagettftext ($image , $font['size'] , $font['angle'] , $font['x-offset'] , $font['y-offset'] , $font['color'] , $font['file'], $text );
        ob_start();
        imagegif($image);
        $frames[]=ob_get_contents();
        $delays[]=$delay;
        $loops = 0;
        ob_end_clean();

`


问:
Post parameters with php file_get_contents not sent
I have this code:

```<code>$postdata = http_build_query(
            array(
                'file' => $_FILES['file']['tmp_name'],
                'quality' => "75",
                'path' => "myfile.jpg",
                'dpi' => "300"
            )
        );
        $opts = array('http' =>
            array(
                'type' => "POST",
                'header' => "Content-type: multipart/form-data\r\nxhrFields: { withCredentials: true }\r\ncache: false\r\ncrossDomain: true\r\nprocessData: false\r\ncontentType: false" ,
                'content' => $postdata
            )
        );
        $context = stream_context_create($opts);
        $result = file_get_contents('https://example.com/myphpfile.php', false, $context);
        echo $result;
</code>```

In myphpfile.php I read the post file parameter in this way:

```<code>$pdf = $_POST["file"];
$dpi = $_POST["dpi"];
$quality = $_POST["quality"];
$path = $_POST["path"];

print_r($_POST);
</code>```

And I get this response:

```<code>Notice: Undefined index: file in /var/www/html/example/myphpfile.php on line 14

Notice: Undefined index: dpi in /var/www/html/example/myphpfile.php on line 15

Notice: Undefined index: quality in /var/www/html/example/myphpfile.php on line 16

Notice: Undefined index: path in /var/www/html/example/myphpfile.php on line 17
Array ( )
</code>```

I cannot understand what is going wrong.

Body:
I have this code:

$postdata = http_build_query(
            array(
                'file' => $_FILES['file']['tmp_name'],
                'quality' => "75",
                'path' => "myfile.jpg",
                'dpi' => "300"
            )
        );
        $opts = array('http' =>
            array(
                'type' => "POST",
                'header' => "Content-type: multipart/form-data\r\nxhrFields: { withCredentials: true }\r\ncache: false\r\ncrossDomain: true\r\nprocessData: false\r\ncontentType: false" ,
                'content' => $postdata
            )
        );
        $context = stream_context_create($opts);
        $result = file_get_contents('https://example.com/myphpfile.php', false, $context);
        echo $result;

In myphpfile.php I read the post file parameter in this way:

$pdf = $_POST["file"];
$dpi = $_POST["dpi"];
$quality = $_POST["quality"];
$path = $_POST["path"];

print_r($_POST);

And I get this response:

Notice: Undefined index: file in /var/www/html/example/myphpfile.php on line 14

Notice: Undefined index: dpi in /var/www/html/example/myphpfile.php on line 15

Notice: Undefined index: quality in /var/www/html/example/myphpfile.php on line 16

Notice: Undefined index: path in /var/www/html/example/myphpfile.php on line 17
Array ( )

I cannot understand what is going wrong.


问:
Authentication in Newman using XSRF-TOKEN and Cookies: I'm obtaining 200 in Postman and 401 in Newman
I'm a beginner in Newman and trying to make a proof of concept to evaluate this tool.
I've used it before but with basic authentication and never had this kind of problem.
The thing is, I'm obtaining different results, running the same collection from Postman and from Newman.

The collection is pretty simple:

login request: POST /login

create item request: POST /my-api/items

The issue is with the second request. From Postman, I get a 200 OK, and from Newman, the same request returns 401 Unauthorized.
So, it seems to be an issue with the authorization.

This is what I know about how the authorization works for this API:
It consists of 2 things:

An XSRF-TOKEN that is passed as header (x-xsrf-token)

and 2 cookies (xsrf-token and session).

These values are obtained from the login request, specifically from the response headers, where we have 2 Set-Cookie headers with the corresponding values for the cookies. The xsrf-token that then is passed as a header is the same value that is stored as a cookie.

How I'm obtaining the values and using them

In the request 1 (login) I have the following code in the Test tab:

// Save cookies from response headers to use it in subsequent requests
const cookies = pm.response.headers.all().filter(headerObj => headerObj.key === 'Set-Cookie').map(headerObj => headerObj.value.split(';')[0]);
pm.environment.set('cookies', cookies.join('; '));

// Save XSRF token obtained from the set-cookie header to use it in subsequent requests
const xsrf_token = cookies[0].split('=')[1].split(';')[0].replace('%3D','=')
pm.environment.set("X-XSRF-TOKEN", xsrf_token)
```
<p>If I print the saved values I obtain something like this:</p>
<p>eyJpdiI6IkNKTjhwTFlVSi9oM3pMelpaQnlJdVE9PSIsInZhbHVlIjoiWlo5eTJmNEJMUVo4Sk9FY3ZjNFNDbWpQNkswK1JzMnhXeS9WeE0zM3Y0cG51ZWo4RGRXNjdqbFEwSWVmSHBRTHIvZkkwRjkxRzFpRC9Gck9tTkpXdE8xVFdkcWtPaUV2MGdCSXY3V3lTcm9Qam1ocWFvSkorUzlMbStneURFRDEiLCJtYWMiOiIzODJhOTlhZjM4NTI0MTU2MDYzMmMxNzYwODc3MjY2YzFlN2M5N2VlNmEwNjk5M2ZlODg2ZjVmMTdjOWY2OWM1IiwidGFnIjoiIn0=</p>
<p>XSRF-TOKEN=eyJpdiI6IkNKTjhwTFlVSi9oM3pMelpaQnlJdVE9PSIsInZhbHVlIjoiWlo5eTJmNEJMUVo4Sk9FY3ZjNFNDbWpQNkswK1JzMnhXeS9WeE0zM3Y0cG51ZWo4RGRXNjdqbFEwSWVmSHBRTHIvZkkwRjkxRzFpRC9Gck9tTkpXdE8xVFdkcWtPaUV2MGdCSXY3V3lTcm9Qam1ocWFvSkorUzlMbStneURFRDEiLCJtYWMiOiIzODJhOTlhZjM4NTI0MTU2MDYzMmMxNzYwODc3MjY2YzFlN2M5N2VlNmEwNjk5M2ZlODg2ZjVmMTdjOWY2OWM1IiwidGFnIjoiIn0%3D; app_session=eyJpdiI6IkhORGRvRC9CQW5nWDZCOXl3LzNUb1E9PSIsInZhbHVlIjoiZW9CZHQ2R09ZcHRjc3VLaVZEUDE0cTlJSzdMVnlGa3JCQ0VycXNxM08yaEljVlBBbXFxS2lOYUdzaTdEK2R1OGZoc2xCenFId0FCMnp2bmNFck9kRHdNOTRGdGRvL1FkaFUxcmJHekx5Wm14KzFhU3RiWTd3QjBuNm1KWS8wZEUiLCJtYWMiOiJmNjhhZDQ3NDgwODE3M2E5MTA3NGIwM2E0OWFkZmRlZTA0YmNmMTNkMDZkZjQyZjk1ZjBhZTIxYjJiN2FmNDZkIiwidGFnIjoiIn0%3D</p>
<ol start="2">
<li>In the request 2 (create item) I do the following in the pre-request tab:</li>
</ol>
```pm.request.headers.add({
  key: "X-XSRF-TOKEN",
  value: pm.environment.get("X-XSRF-TOKEN")
});
pm.request.headers.add({
  key: "Cookie",
  value: pm.environment.get("cookies")
});
```

Note: Also tried inserting the varaibles directly in headers ex: Cookie: {{cookies}} but with the same result.

So, if I run this from Postman, this second request respond 200 and the item is created (expected response).
When running it from Newman I get 401.

Newman command i'm using:

newman run "Collection.postman_collection.json" -e "Develop.postman_environment.json" -r htmlextra,cli,json --reporter-htmlextra-export  testResults/htmlreport.html --reporter-json-export verbose-report.json > testResults/output-log.log --verbose

Note: Also tried running the same with Postman CLI instead newman and got the same result.

Things I've tried without success:

Check that collection is correctly exported and the same for the environment file. I also tried collection v2 and v2.1.

Inspect the reports carefully to see if the headers are being sent correctly. All seems to be ok. I also compared it to request inspection from the browser navigating the app UI and didn't notice any difference.

Obtain values from Postman (cookies and token), hardcode it to request 2, export, and run with Newman -> it works. 200 obtained.

Vice versa: Obtained values from Newman run, copy and hardcode it to postman -> It doesn't work. 401 reproduced.

I've checked carefully the values for the cookies and token, spaces and so on, and all seems to be ok.

Has anyone had a problem like this? any other ideas to try?
Thanks in advance

Body:
I'm a beginner in Newman and trying to make a proof of concept to evaluate this tool.
I've used it before but with basic authentication and never had this kind of problem.
The thing is, I'm obtaining different results, running the same collection from Postman and from Newman.

The collection is pretty simple:

login request: POST /login

create item request: POST /my-api/items

The issue is with the second request. From Postman, I get a 200 OK, and from Newman, the same request returns 401 Unauthorized.
So, it seems to be an issue with the authorization.

This is what I know about how the authorization works for this API:
It consists of 2 things:

An XSRF-TOKEN that is passed as header (x-xsrf-token)

and 2 cookies (xsrf-token and session).

These values are obtained from the login request, specifically from the response headers, where we have 2 Set-Cookie headers with the corresponding values for the cookies. The xsrf-token that then is passed as a header is the same value that is stored as a cookie.

How I'm obtaining the values and using them

In the request 1 (login) I have the following code in the Test tab:

// Save cookies from response headers to use it in subsequent requests
const cookies = pm.response.headers.all().filter(headerObj => headerObj.key === 'Set-Cookie').map(headerObj => headerObj.value.split(';')[0]);
pm.environment.set('cookies', cookies.join('; '));

// Save XSRF token obtained from the set-cookie header to use it in subsequent requests
const xsrf_token = cookies[0].split('=')[1].split(';')[0].replace('%3D','=')
pm.environment.set("X-XSRF-TOKEN", xsrf_token)

If I print the saved values I obtain something like this:

eyJpdiI6IkNKTjhwTFlVSi9oM3pMelpaQnlJdVE9PSIsInZhbHVlIjoiWlo5eTJmNEJMUVo4Sk9FY3ZjNFNDbWpQNkswK1JzMnhXeS9WeE0zM3Y0cG51ZWo4RGRXNjdqbFEwSWVmSHBRTHIvZkkwRjkxRzFpRC9Gck9tTkpXdE8xVFdkcWtPaUV2MGdCSXY3V3lTcm9Qam1ocWFvSkorUzlMbStneURFRDEiLCJtYWMiOiIzODJhOTlhZjM4NTI0MTU2MDYzMmMxNzYwODc3MjY2YzFlN2M5N2VlNmEwNjk5M2ZlODg2ZjVmMTdjOWY2OWM1IiwidGFnIjoiIn0=

XSRF-TOKEN=eyJpdiI6IkNKTjhwTFlVSi9oM3pMelpaQnlJdVE9PSIsInZhbHVlIjoiWlo5eTJmNEJMUVo4Sk9FY3ZjNFNDbWpQNkswK1JzMnhXeS9WeE0zM3Y0cG51ZWo4RGRXNjdqbFEwSWVmSHBRTHIvZkkwRjkxRzFpRC9Gck9tTkpXdE8xVFdkcWtPaUV2MGdCSXY3V3lTcm9Qam1ocWFvSkorUzlMbStneURFRDEiLCJtYWMiOiIzODJhOTlhZjM4NTI0MTU2MDYzMmMxNzYwODc3MjY2YzFlN2M5N2VlNmEwNjk5M2ZlODg2ZjVmMTdjOWY2OWM1IiwidGFnIjoiIn0%3D; app_session=eyJpdiI6IkhORGRvRC9CQW5nWDZCOXl3LzNUb1E9PSIsInZhbHVlIjoiZW9CZHQ2R09ZcHRjc3VLaVZEUDE0cTlJSzdMVnlGa3JCQ0VycXNxM08yaEljVlBBbXFxS2lOYUdzaTdEK2R1OGZoc2xCenFId0FCMnp2bmNFck9kRHdNOTRGdGRvL1FkaFUxcmJHekx5Wm14KzFhU3RiWTd3QjBuNm1KWS8wZEUiLCJtYWMiOiJmNjhhZDQ3NDgwODE3M2E5MTA3NGIwM2E0OWFkZmRlZTA0YmNmMTNkMDZkZjQyZjk1ZjBhZTIxYjJiN2FmNDZkIiwidGFnIjoiIn0%3D

In the request 2 (create item) I do the following in the pre-request tab:

pm.request.headers.add({
  key: "X-XSRF-TOKEN",
  value: pm.environment.get("X-XSRF-TOKEN")
});
pm.request.headers.add({
  key: "Cookie",
  value: pm.environment.get("cookies")
});

Note: Also tried inserting the varaibles directly in headers ex: Cookie: {{cookies}} but with the same result.

So, if I run this from Postman, this second request respond 200 and the item is created (expected response).
When running it from Newman I get 401.

Newman command i'm using:

newman run "Collection.postman_collection.json" -e "Develop.postman_environment.json" -r htmlextra,cli,json --reporter-htmlextra-export  testResults/htmlreport.html --reporter-json-export verbose-report.json > testResults/output-log.log --verbose

Note: Also tried running the same with Postman CLI instead newman and got the same result.

Things I've tried without success:

Check that collection is correctly exported and the same for the environment file. I also tried collection v2 and v2.1.

Inspect the reports carefully to see if the headers are being sent correctly. All seems to be ok. I also compared it to request inspection from the browser navigating the app UI and didn't notice any difference.

Obtain values from Postman (cookies and token), hardcode it to request 2, export, and run with Newman -> it works. 200 obtained.

Vice versa: Obtained values from Newman run, copy and hardcode it to postman -> It doesn't work. 401 reproduced.

I've checked carefully the values for the cookies and token, spaces and so on, and all seems to be ok.

Has anyone had a problem like this? any other ideas to try?
Thanks in advance


问:
ASP.NET Core 6 : cascading foreign key 'x' cannot be created where the referencing column 'y' is an identity column
I'm new to building web applications with ASP.NET Core MVC.

My current issue is that I got a lot of errors trying to add users to my database. Previous issue that I had was when I tried creating a new user:

Cannot use table 'Users' for entity type 'Users' since it is being used for entity type 'CineLibrary User' and potentially other entity types, but there is no linking relationship. Add a foreign key to 'Users' on the primary key properties and pointing to the primary key on another entity type mapped to 'Users'.

The issue that I have now is with updating my database:

Cascading foreign key 'FK_RoleClaims_IdentityRoleClaim_Id' cannot be created where the referencing column 'RoleClaims.Id' is an identity column.

Could not create constraint or index. See previous errors.

Here is my migration that I'm trying to apply:

```<code>using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace CineLibrary.Infrastructure.Migrations
{
    public partial class IdentityChangesMigration : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AspNetRoleClaims");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Users",
                table: "Users");

            migrationBuilder.RenameTable(
                name: "Users",
               newName: "IdentityUser");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "UserClaims",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "RoleClaims",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AddColumn<string>(
                name: "Discriminator",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "IdentityUser_AccessFailedCount",
                table: "IdentityUser",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_ConcurrencyStamp",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_Email",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IdentityUser_EmailConfirmed",
                table: "IdentityUser",
                type: "bit",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IdentityUser_LockoutEnabled",
                table: "IdentityUser",
                type: "bit",
                nullable: true);

            migrationBuilder.AddColumn<DateTimeOffset>(
                name: "IdentityUser_LockoutEnd",
                table: "IdentityUser",
                type: "datetimeoffset",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_NormalizedEmail",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_NormalizedUserName",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_PasswordHash",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_PhoneNumber",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IdentityUser_PhoneNumberConfirmed",
                table: "IdentityUser",
                type: "bit",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_SecurityStamp",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IdentityUser_TwoFactorEnabled",
                table: "IdentityUser",
                type: "bit",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_UserName",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_IdentityUser",
                table: "IdentityUser",
                column: "Id");

            migrationBuilder.CreateTable(
               name: "AspNetRoleClaims",
               columns: table => new
               {
                   Id = table.Column<int>(type: "int", nullable: false)
                       .Annotation("SqlServer:Identity", "1, 1"),
                   RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                   ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                   ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
               },
               constraints: table =>
               {
                   table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                   table.ForeignKey(
                       name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                       column: x => x.RoleId,
                       principalTable: "AspNetRoles",
                       principalColumn: "Id",
                       onDelete: ReferentialAction.Cascade);
               });

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateTable(
                name: "IdentityRole",
                columns: table => new
                {
                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    NormalizedName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_IdentityRole", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "IdentityRoleClaim<string>",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_IdentityRoleClaim<string>", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "IdentityUserClaim<string>",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_IdentityUserClaim<string>", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "IdentityUserLogin<string>",
                columns: table => new
                {
                    LoginProvider = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProviderKey = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserId = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                });

            migrationBuilder.CreateTable(
                name: "IdentityUserRole<string>",
                columns: table => new
                {
                    UserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RoleId = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                });

            migrationBuilder.CreateTable(
                name: "IdentityUserToken<string>",
                columns: table => new
                {
                    UserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LoginProvider = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                });

            migrationBuilder.AddForeignKey(
                name: "FK_RoleClaims_IdentityRoleClaim<string>_Id",
                table: "RoleClaims",
                column: "Id",
                principalTable: "IdentityRoleClaim<string>",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Roles_IdentityRole_Id",
                table: "Roles",
                column: "Id",
                principalTable: "IdentityRole",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_UserClaims_IdentityUserClaim<string>_Id",
                table: "UserClaims",
                column: "Id",
                principalTable: "IdentityUserClaim<string>",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_RoleClaims_IdentityRoleClaim<string>_Id",
                table: "RoleClaims");

            migrationBuilder.DropForeignKey(
                name: "FK_Roles_IdentityRole_Id",
                table: "Roles");

            migrationBuilder.DropForeignKey(
                name: "FK_UserClaims_IdentityUserClaim<string>_Id",
                table: "UserClaims");

            migrationBuilder.DropTable(
                name: "IdentityRole");

            migrationBuilder.DropTable(
                name: "IdentityRoleClaim<string>");

            migrationBuilder.DropTable(
                name: "IdentityUserClaim<string>");

            migrationBuilder.DropTable(
                name: "IdentityUserLogin<string>");

            migrationBuilder.DropTable(
                name: "IdentityUserRole<string>");

            migrationBuilder.DropTable(
                name: "IdentityUserToken<string>");

            migrationBuilder.DropPrimaryKey(
                name: "PK_IdentityUser",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "Discriminator",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_AccessFailedCount",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_ConcurrencyStamp",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_Email",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_EmailConfirmed",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_LockoutEnabled",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_LockoutEnd",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_NormalizedEmail",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_NormalizedUserName",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_PasswordHash",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_PhoneNumber",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_PhoneNumberConfirmed",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_SecurityStamp",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_TwoFactorEnabled",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_UserName",
                table: "IdentityUser");

            migrationBuilder.RenameTable(
                name: "IdentityUser",
                newName: "Users");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "UserClaims",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .Annotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "RoleClaims",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .Annotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Users",
                table: "Users",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "AspNetRoleClaims",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AspNetRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");
        }
    }
}
</code>```

The context class with all the tables:

```<code>// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using CineLibrary.Infrastructure.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace CineLibrary.Infrastructure.Data
{
    public partial class CineLibraryContext : IdentityDbContext<CineLibraryUser>
    {
        public CineLibraryContext()
        {
        }

        public CineLibraryContext(DbContextOptions<CineLibraryContext> options)
            : base(options)
        {
        }

        public virtual DbSet<AspNetRoles> AspNetRoles { get; set; }
        public virtual DbSet<AspNetUserClaims> AspNetUserClaims { get; set; }
        public virtual DbSet<AspNetUserLogins> AspNetUserLogins { get; set; }
        public virtual DbSet<AspNetUserTokens> AspNetUserTokens { get; set; }
        public virtual DbSet<AspNetUsers> AspNetUsers { get; set; }
        public virtual DbSet<Categories> Categories { get; set; }
        public virtual DbSet<Favourites> Favourites { get; set; }
        public virtual DbSet<Movies> Movies { get; set; }
        public virtual DbSet<RoleClaims> RoleClaims { get; set; }
        public virtual DbSet<Roles> Roles { get; set; }
        public virtual DbSet<UserClaims> UserClaims { get; set; }
        public virtual DbSet<UserLogins> UserLogins { get; set; }
        public virtual DbSet<UserRoles> UserRoles { get; set; }
        public virtual DbSet<UserTokens> UserTokens { get; set; }
        public virtual DbSet<Users> Users { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseSqlServer("Data Source=DESKTOP-0VH2JPM;Initial Catalog=CineLib;Integrated Security=True");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<IdentityUserLogin<string>>(entity =>
            {
                entity.HasNoKey();
            }).Entity<IdentityUserRole<string>>(entity =>
            {
                entity.HasNoKey();
            }).Entity<IdentityUserToken<string>>(entity =>
            {
                entity.HasNoKey();
            });

            modelBuilder.Entity<Users>(b =>
            {
                b.ToTable("IdentityUser");
                b.Property(x => x.Id).HasColumnName(nameof(IdentityUser.Id));
                b.HasOne<IdentityUser>().WithOne().HasForeignKey<IdentityUser>(x => x.Id);
            }).Entity<RoleClaims>(b =>
            {
                b.ToTable("IdentityRoleClaim<string>");
                b.Property(x => x.Id).HasColumnName(nameof(IdentityRoleClaim<string>.Id));
                b.HasOne<IdentityRoleClaim<string>>().WithOne().HasForeignKey<IdentityRoleClaim<string>>(x => x.Id);
            }).Entity<Roles>(b =>
            {
                b.ToTable("IdentityRole");
                b.Property(x => x.Id).HasColumnName(nameof(IdentityRole.Id));
                b.HasOne<IdentityRole>().WithOne().HasForeignKey<IdentityRole>(x => x.Id);
            }).Entity<UserClaims>(b =>
            {
                b.ToTable("IdentityUserClaim<string>");
                b.Property(x => x.Id).HasColumnName(nameof(IdentityUserClaim<string>.Id));
                b.HasOne<IdentityUserClaim<string>>().WithOne().HasForeignKey<IdentityUserClaim<string>>(x => x.Id);
            }).Entity<UserLogins>(b =>
            {
                b.ToTable("IdentityUserLogin<string>");
                b.Property(x => x.UserId).HasColumnName(nameof(IdentityUserLogin<string>.UserId));
                b.HasOne<IdentityUserLogin<string>>().WithOne().HasForeignKey<IdentityUserLogin<string>>(x => x.UserId);
            }).Entity<UserRoles>(b =>
            {
                b.ToTable("IdentityUserRole<string>");
                b.Property(x => x.UserId).HasColumnName(nameof(IdentityUserRole<string>.UserId));
                b.HasOne<IdentityUserRole<string>>().WithOne().HasForeignKey<IdentityUserRole<string>>(x => x.UserId);
            }).Entity<UserTokens>(b =>
            {
                b.ToTable("IdentityUserToken<string>");
                b.Property(x => x.UserId).HasColumnName(nameof(IdentityUserToken<string>.UserId));
                b.HasOne<IdentityUserToken<string>>().WithOne().HasForeignKey<IdentityUserToken<string>>(x => x.UserId);
            });

            modelBuilder.Entity<AspNetRoles>(entity =>
            {
                entity.HasIndex(e => e.NormalizedName, "RoleNameIndex")
                    .IsUnique()
                    .HasFilter("([NormalizedName] IS NOT NULL)");

                entity.Property(e => e.Name).HasMaxLength(256);

                entity.Property(e => e.NormalizedName).HasMaxLength(256);
            });

            modelBuilder.Entity<AspNetUserClaims>(entity =>
            {
                entity.HasIndex(e => e.UserId, "IX_AspNetUserClaims_UserId");

                entity.Property(e => e.UserId).IsRequired();

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserClaims)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<AspNetUserLogins>(entity =>
            {
                entity.HasKey(e => new { e.LoginProvider, e.ProviderKey });

                entity.HasIndex(e => e.UserId, "IX_AspNetUserLogins_UserId");

                entity.Property(e => e.LoginProvider).HasMaxLength(128);

                entity.Property(e => e.ProviderKey).HasMaxLength(128);

                entity.Property(e => e.UserId).IsRequired();

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserLogins)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<AspNetUserTokens>(entity =>
            {
                entity.HasKey(e => new { e.UserId, e.LoginProvider, e.Name });

                entity.Property(e => e.LoginProvider).HasMaxLength(128);

                entity.Property(e => e.Name).HasMaxLength(128);

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserTokens)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<AspNetUsers>(entity =>
            {
                entity.HasIndex(e => e.NormalizedEmail, "EmailIndex");

                entity.HasIndex(e => e.NormalizedUserName, "UserNameIndex")
                    .IsUnique()
                    .HasFilter("([NormalizedUserName] IS NOT NULL)");

                entity.Property(e => e.Email).HasMaxLength(256);

                entity.Property(e => e.NormalizedEmail).HasMaxLength(256);

                entity.Property(e => e.NormalizedUserName).HasMaxLength(256);

                entity.Property(e => e.UserName).HasMaxLength(256);

                entity.HasMany(d => d.Role)
                    .WithMany(p => p.User)
                    .UsingEntity<Dictionary<string, object>>(
                        "AspNetUserRoles",
                        l => l.HasOne<AspNetRoles>().WithMany().HasForeignKey("RoleId"),
                        r => r.HasOne<AspNetUsers>().WithMany().HasForeignKey("UserId"),
                        j =>
                        {
                            j.HasKey("UserId", "RoleId");

                            j.ToTable("AspNetUserRoles");

                            j.HasIndex(new[] { "RoleId" }, "IX_AspNetUserRoles_RoleId");
                        });
            });

            modelBuilder.Entity<Categories>(entity =>
            {
                entity.HasKey(e => e.categoryId);

                entity.Property(e => e.categoryId).ValueGeneratedNever();

                entity.Property(e => e.categoryName).IsRequired();
            });

            modelBuilder.Entity<Favourites>(entity =>
            {
                entity.HasKey(e => e.favouriteId);

                entity.Property(e => e.favouriteId).ValueGeneratedNever();
            });

            modelBuilder.Entity<Movies>(entity =>
            {
                entity.HasKey(e => e.movieId);

                entity.Property(e => e.movieId).ValueGeneratedNever();

                entity.Property(e => e.movieName).IsRequired();
            });

            modelBuilder.Entity<UserLogins>(entity =>
            {
                entity.HasNoKey();
            });

            modelBuilder.Entity<UserRoles>(entity =>
            {
                entity.HasNoKey();
            });

            modelBuilder.Entity<UserTokens>(entity =>
            {
                entity.HasNoKey();
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
</code>```

Body:
I'm new to building web applications with ASP.NET Core MVC.

My current issue is that I got a lot of errors trying to add users to my database. Previous issue that I had was when I tried creating a new user:

Cannot use table 'Users' for entity type 'Users' since it is being used for entity type 'CineLibrary User' and potentially other entity types, but there is no linking relationship. Add a foreign key to 'Users' on the primary key properties and pointing to the primary key on another entity type mapped to 'Users'.

The issue that I have now is with updating my database:

Cascading foreign key 'FK_RoleClaims_IdentityRoleClaim_Id' cannot be created where the referencing column 'RoleClaims.Id' is an identity column.

Could not create constraint or index. See previous errors.

Here is my migration that I'm trying to apply:

using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace CineLibrary.Infrastructure.Migrations
{
    public partial class IdentityChangesMigration : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AspNetRoleClaims");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Users",
                table: "Users");

            migrationBuilder.RenameTable(
                name: "Users",
               newName: "IdentityUser");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "UserClaims",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "RoleClaims",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .OldAnnotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AddColumn<string>(
                name: "Discriminator",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "IdentityUser_AccessFailedCount",
                table: "IdentityUser",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_ConcurrencyStamp",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_Email",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IdentityUser_EmailConfirmed",
                table: "IdentityUser",
                type: "bit",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IdentityUser_LockoutEnabled",
                table: "IdentityUser",
                type: "bit",
                nullable: true);

            migrationBuilder.AddColumn<DateTimeOffset>(
                name: "IdentityUser_LockoutEnd",
                table: "IdentityUser",
                type: "datetimeoffset",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_NormalizedEmail",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_NormalizedUserName",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_PasswordHash",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_PhoneNumber",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IdentityUser_PhoneNumberConfirmed",
                table: "IdentityUser",
                type: "bit",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_SecurityStamp",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IdentityUser_TwoFactorEnabled",
                table: "IdentityUser",
                type: "bit",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "IdentityUser_UserName",
                table: "IdentityUser",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_IdentityUser",
                table: "IdentityUser",
                column: "Id");

            migrationBuilder.CreateTable(
               name: "AspNetRoleClaims",
               columns: table => new
               {
                   Id = table.Column<int>(type: "int", nullable: false)
                       .Annotation("SqlServer:Identity", "1, 1"),
                   RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                   ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                   ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
               },
               constraints: table =>
               {
                   table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                   table.ForeignKey(
                       name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                       column: x => x.RoleId,
                       principalTable: "AspNetRoles",
                       principalColumn: "Id",
                       onDelete: ReferentialAction.Cascade);
               });

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateTable(
                name: "IdentityRole",
                columns: table => new
                {
                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    NormalizedName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_IdentityRole", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "IdentityRoleClaim<string>",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_IdentityRoleClaim<string>", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "IdentityUserClaim<string>",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_IdentityUserClaim<string>", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "IdentityUserLogin<string>",
                columns: table => new
                {
                    LoginProvider = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProviderKey = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserId = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                });

            migrationBuilder.CreateTable(
                name: "IdentityUserRole<string>",
                columns: table => new
                {
                    UserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    RoleId = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                });

            migrationBuilder.CreateTable(
                name: "IdentityUserToken<string>",
                columns: table => new
                {
                    UserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LoginProvider = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                });

            migrationBuilder.AddForeignKey(
                name: "FK_RoleClaims_IdentityRoleClaim<string>_Id",
                table: "RoleClaims",
                column: "Id",
                principalTable: "IdentityRoleClaim<string>",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Roles_IdentityRole_Id",
                table: "Roles",
                column: "Id",
                principalTable: "IdentityRole",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_UserClaims_IdentityUserClaim<string>_Id",
                table: "UserClaims",
                column: "Id",
                principalTable: "IdentityUserClaim<string>",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_RoleClaims_IdentityRoleClaim<string>_Id",
                table: "RoleClaims");

            migrationBuilder.DropForeignKey(
                name: "FK_Roles_IdentityRole_Id",
                table: "Roles");

            migrationBuilder.DropForeignKey(
                name: "FK_UserClaims_IdentityUserClaim<string>_Id",
                table: "UserClaims");

            migrationBuilder.DropTable(
                name: "IdentityRole");

            migrationBuilder.DropTable(
                name: "IdentityRoleClaim<string>");

            migrationBuilder.DropTable(
                name: "IdentityUserClaim<string>");

            migrationBuilder.DropTable(
                name: "IdentityUserLogin<string>");

            migrationBuilder.DropTable(
                name: "IdentityUserRole<string>");

            migrationBuilder.DropTable(
                name: "IdentityUserToken<string>");

            migrationBuilder.DropPrimaryKey(
                name: "PK_IdentityUser",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "Discriminator",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_AccessFailedCount",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_ConcurrencyStamp",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_Email",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_EmailConfirmed",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_LockoutEnabled",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_LockoutEnd",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_NormalizedEmail",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_NormalizedUserName",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_PasswordHash",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_PhoneNumber",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_PhoneNumberConfirmed",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_SecurityStamp",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_TwoFactorEnabled",
                table: "IdentityUser");

            migrationBuilder.DropColumn(
                name: "IdentityUser_UserName",
                table: "IdentityUser");

            migrationBuilder.RenameTable(
                name: "IdentityUser",
                newName: "Users");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "UserClaims",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .Annotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AlterColumn<int>(
                name: "Id",
                table: "RoleClaims",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .Annotation("SqlServer:Identity", "1, 1");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Users",
                table: "Users",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "AspNetRoleClaims",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AspNetRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");
        }
    }
}

The context class with all the tables:

// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
#nullable disable
using System;
using System.Collections.Generic;
using CineLibrary.Infrastructure.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace CineLibrary.Infrastructure.Data
{
    public partial class CineLibraryContext : IdentityDbContext<CineLibraryUser>
    {
        public CineLibraryContext()
        {
        }

        public CineLibraryContext(DbContextOptions<CineLibraryContext> options)
            : base(options)
        {
        }

        public virtual DbSet<AspNetRoles> AspNetRoles { get; set; }
        public virtual DbSet<AspNetUserClaims> AspNetUserClaims { get; set; }
        public virtual DbSet<AspNetUserLogins> AspNetUserLogins { get; set; }
        public virtual DbSet<AspNetUserTokens> AspNetUserTokens { get; set; }
        public virtual DbSet<AspNetUsers> AspNetUsers { get; set; }
        public virtual DbSet<Categories> Categories { get; set; }
        public virtual DbSet<Favourites> Favourites { get; set; }
        public virtual DbSet<Movies> Movies { get; set; }
        public virtual DbSet<RoleClaims> RoleClaims { get; set; }
        public virtual DbSet<Roles> Roles { get; set; }
        public virtual DbSet<UserClaims> UserClaims { get; set; }
        public virtual DbSet<UserLogins> UserLogins { get; set; }
        public virtual DbSet<UserRoles> UserRoles { get; set; }
        public virtual DbSet<UserTokens> UserTokens { get; set; }
        public virtual DbSet<Users> Users { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseSqlServer("Data Source=DESKTOP-0VH2JPM;Initial Catalog=CineLib;Integrated Security=True");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<IdentityUserLogin<string>>(entity =>
            {
                entity.HasNoKey();
            }).Entity<IdentityUserRole<string>>(entity =>
            {
                entity.HasNoKey();
            }).Entity<IdentityUserToken<string>>(entity =>
            {
                entity.HasNoKey();
            });

            modelBuilder.Entity<Users>(b =>
            {
                b.ToTable("IdentityUser");
                b.Property(x => x.Id).HasColumnName(nameof(IdentityUser.Id));
                b.HasOne<IdentityUser>().WithOne().HasForeignKey<IdentityUser>(x => x.Id);
            }).Entity<RoleClaims>(b =>
            {
                b.ToTable("IdentityRoleClaim<string>");
                b.Property(x => x.Id).HasColumnName(nameof(IdentityRoleClaim<string>.Id));
                b.HasOne<IdentityRoleClaim<string>>().WithOne().HasForeignKey<IdentityRoleClaim<string>>(x => x.Id);
            }).Entity<Roles>(b =>
            {
                b.ToTable("IdentityRole");
                b.Property(x => x.Id).HasColumnName(nameof(IdentityRole.Id));
                b.HasOne<IdentityRole>().WithOne().HasForeignKey<IdentityRole>(x => x.Id);
            }).Entity<UserClaims>(b =>
            {
                b.ToTable("IdentityUserClaim<string>");
                b.Property(x => x.Id).HasColumnName(nameof(IdentityUserClaim<string>.Id));
                b.HasOne<IdentityUserClaim<string>>().WithOne().HasForeignKey<IdentityUserClaim<string>>(x => x.Id);
            }).Entity<UserLogins>(b =>
            {
                b.ToTable("IdentityUserLogin<string>");
                b.Property(x => x.UserId).HasColumnName(nameof(IdentityUserLogin<string>.UserId));
                b.HasOne<IdentityUserLogin<string>>().WithOne().HasForeignKey<IdentityUserLogin<string>>(x => x.UserId);
            }).Entity<UserRoles>(b =>
            {
                b.ToTable("IdentityUserRole<string>");
                b.Property(x => x.UserId).HasColumnName(nameof(IdentityUserRole<string>.UserId));
                b.HasOne<IdentityUserRole<string>>().WithOne().HasForeignKey<IdentityUserRole<string>>(x => x.UserId);
            }).Entity<UserTokens>(b =>
            {
                b.ToTable("IdentityUserToken<string>");
                b.Property(x => x.UserId).HasColumnName(nameof(IdentityUserToken<string>.UserId));
                b.HasOne<IdentityUserToken<string>>().WithOne().HasForeignKey<IdentityUserToken<string>>(x => x.UserId);
            });

            modelBuilder.Entity<AspNetRoles>(entity =>
            {
                entity.HasIndex(e => e.NormalizedName, "RoleNameIndex")
                    .IsUnique()
                    .HasFilter("([NormalizedName] IS NOT NULL)");

                entity.Property(e => e.Name).HasMaxLength(256);

                entity.Property(e => e.NormalizedName).HasMaxLength(256);
            });

            modelBuilder.Entity<AspNetUserClaims>(entity =>
            {
                entity.HasIndex(e => e.UserId, "IX_AspNetUserClaims_UserId");

                entity.Property(e => e.UserId).IsRequired();

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserClaims)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<AspNetUserLogins>(entity =>
            {
                entity.HasKey(e => new { e.LoginProvider, e.ProviderKey });

                entity.HasIndex(e => e.UserId, "IX_AspNetUserLogins_UserId");

                entity.Property(e => e.LoginProvider).HasMaxLength(128);

                entity.Property(e => e.ProviderKey).HasMaxLength(128);

                entity.Property(e => e.UserId).IsRequired();

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserLogins)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<AspNetUserTokens>(entity =>
            {
                entity.HasKey(e => new { e.UserId, e.LoginProvider, e.Name });

                entity.Property(e => e.LoginProvider).HasMaxLength(128);

                entity.Property(e => e.Name).HasMaxLength(128);

                entity.HasOne(d => d.User)
                    .WithMany(p => p.AspNetUserTokens)
                    .HasForeignKey(d => d.UserId);
            });

            modelBuilder.Entity<AspNetUsers>(entity =>
            {
                entity.HasIndex(e => e.NormalizedEmail, "EmailIndex");

                entity.HasIndex(e => e.NormalizedUserName, "UserNameIndex")
                    .IsUnique()
                    .HasFilter("([NormalizedUserName] IS NOT NULL)");

                entity.Property(e => e.Email).HasMaxLength(256);

                entity.Property(e => e.NormalizedEmail).HasMaxLength(256);

                entity.Property(e => e.NormalizedUserName).HasMaxLength(256);

                entity.Property(e => e.UserName).HasMaxLength(256);

                entity.HasMany(d => d.Role)
                    .WithMany(p => p.User)
                    .UsingEntity<Dictionary<string, object>>(
                        "AspNetUserRoles",
                        l => l.HasOne<AspNetRoles>().WithMany().HasForeignKey("RoleId"),
                        r => r.HasOne<AspNetUsers>().WithMany().HasForeignKey("UserId"),
                        j =>
                        {
                            j.HasKey("UserId", "RoleId");

                            j.ToTable("AspNetUserRoles");

                            j.HasIndex(new[] { "RoleId" }, "IX_AspNetUserRoles_RoleId");
                        });
            });

            modelBuilder.Entity<Categories>(entity =>
            {
                entity.HasKey(e => e.categoryId);

                entity.Property(e => e.categoryId).ValueGeneratedNever();

                entity.Property(e => e.categoryName).IsRequired();
            });

            modelBuilder.Entity<Favourites>(entity =>
            {
                entity.HasKey(e => e.favouriteId);

                entity.Property(e => e.favouriteId).ValueGeneratedNever();
            });

            modelBuilder.Entity<Movies>(entity =>
            {
                entity.HasKey(e => e.movieId);

                entity.Property(e => e.movieId).ValueGeneratedNever();

                entity.Property(e => e.movieName).IsRequired();
            });

            modelBuilder.Entity<UserLogins>(entity =>
            {
                entity.HasNoKey();
            });

            modelBuilder.Entity<UserRoles>(entity =>
            {
                entity.HasNoKey();
            });

            modelBuilder.Entity<UserTokens>(entity =>
            {
                entity.HasNoKey();
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}