Most voted "migrations" questions
Migrations allows you, who already work with Codefirst, to generate manageable updates in your database, or if you prefer, let Migrations itself take care of everything automatically, keeping your database always up to date with your classes.
Learn more…102 questions
Sort by count of
-
15
votes4
answers957
viewsMultiple Contexts Migrations Entity Framework
I have several projects and each project has a context. I would like to know, how to use the Migrations to update and generate only one database of these various contexts?
-
7
votes1
answer3147
viewsHelp with setting up Dbcontext with Entityframework using good practices
I have my application divided into layers with Class Library and my layer with the Entity Framework, where I set up the DbContext, is the Repository. My inherited Dbcontext class: public class…
-
6
votes3
answers5260
viewsLaravel: Migrations
I have a question about Migrations do Laravel and I believe you can help me. 1 - I created a model with Migration by php artisan make:model Evento -m; 2 - In addition to increments and timestamps I…
-
6
votes1
answer1308
viewsCreate View in Mysql through Laravel
How can I create a view in the Mysql database through migrations of Laravel? I found nothing in the documentation.
-
5
votes2
answers1185
viewsWhat’s a Seeder for?
I saw in the Laravel that there is a folder called database. In it we have the Migrations and the Seeds. I understand that Migrations are migrations, are codes that provide specifications for…
-
4
votes1
answer84
viewsHow to control migrations in two distinct contexts?
I have two contexts and I would like to know how to activate each of them. For example Add-Migration Contexto 1, Add-Migration 2 How can I add new ones Migrations for each context?…
-
4
votes2
answers3123
viewsError saving Datetime type field
I am mounting an example of Code First, but when saving a field of type Datetime in the database returns me the following error Conversion of a datetime2 data type into a datetime data type resulted…
-
4
votes1
answer96
viewsIs it correct to read the Migrations files and the configuration file?
Files that make the database Migrations should be added in Git versioning? I am using Phinx and I have this doubt regarding the classes that represent the tables that are generated by this library.…
-
3
votes2
answers1498
viewsEntityframework, Migrations and Mysql. Schema name being misinterpreted. How to resolve?
I have a problem using Migrations with Mysql. When I try to create the first version with Migrations he’s making the schema/name of the bank part of the table name: public partial class Initial :…
-
3
votes1
answer1703
viewsMigrate Microsoft SQL to Postgres
I need to migrate my SQL server database to Postgre-SQL, but I don’t have much database intimacy. Is there any tool that can assist in migrating? I have the backup of MS SQL . Bak is it possible to…
-
3
votes1
answer1027
viewsCode First Migrations Mysql - Specify the '-Verbose' flag to view the SQL statements being Applied to the target database
I am creating a web application in C# and because of the hosting server, the database is in Mysql. Then I installed Mysql.Data.Entity, EF6, enabled Migrations, added the Migrations class, but when…
-
3
votes1
answer497
viewsEntity Framework Migration - Indicate migrations as executed
I am working on an ASP.NET MVC system with Entity Framework, which uses Migrations. Has the following initializer: public void InitializeDatabase(Contexto context) { if (!context.Database.Exists())…
-
3
votes1
answer35
viewsstore the formatted value of my created_at date in the ID
I have one question: A column called shoe_id on my table, I’d like that id is automatically generated when I register a product, and I would also like it to be in the format without dividers from…
-
3
votes1
answer132
viewsHow to simplify declaration of types with Entity Frameowrk?
I have some tables with several fields of type datetime, and for all of them I need to create a validation in Onmodelcreating() for this type, IE, I need to define .HasColumnType("datetime");, my…
-
3
votes2
answers76
viewsEntityframework Aspnet Core Migrations
Good evening, I came across a problem to update the DB of an Aspnet Core application. Had created the bank, but ended up deleting, now, while trying to create again using the following commands:…
-
3
votes1
answer32
viewsMigration Conventions
I have an MVC DDD application that uses Sqlserver. I’m trying to get the database to Postgressql, but there is a FK duplicity error. For example, the default Sqlserver would be generated:…
-
3
votes1
answer269
viewsUpdate-database -script in EF Core
In EF6 I could run the "update-database -script" command from Migrations to see the script that would run in the database. How do I get this in EF Core?
-
3
votes1
answer845
viewsEntity Framework with Oracle
I am trying to use EF, using Code Frist, along with an Oracle database, for this I am using the Nuget package Oracle.ManagedDataAccess.Entityframework, but whenever I try to run the Update-Database…
-
3
votes1
answer179
viewsMigrations, Updating a null field to not null
I am updating the phone field and CPF of my User entity that was allowing nulls to not nulls. follow the migration file public partial class Required_fild_users_cpf_phone : DbMigration { public…
-
3
votes1
answer1644
viewsEntity Framework Core 2.0 - Add-Migration does not work
I am creating a new code-first project. When trying to create Migration, using the command [Add-Migration Initial -Context LogAuditoriaContext] it simply does nothing, creates nothing, makes no…
c# asp.net asp.net-core migrations entity-framework-coreasked 6 years, 11 months ago LeoFelipe 1,455 -
2
votes2
answers100
viewsDefault record if no other - mysql
Is it possible to program the database to have a default record if there is no other record in the table? making the table impossible to be empty. then if there are other records it ignores the…
-
2
votes1
answer290
viewsMYSQL to POSTGRESQL via SED
I am looking for a way to migrate my backup from a Mysql database to Postgresql. The simplest way I found was using sed upon backup, but it hasn’t worked. It was like this: 1 - performing a backup 2…
-
2
votes1
answer70
viewsRemove serial column creation Entityframework + Npgsql
Ola, I am creating an application using Fluent API + Entityframework. But in my domain classes when determining that a property is PK it automatically defines it as serial, I would not like to get…
-
2
votes0
answers60
viewsIs there any way to run a Seed only once?
I use the Cakephp 3 framework, I was researching on Migrations and Seeds and I did some testing, the Migrations they run only once on account of the Sphinx log table, but if I do a Seed and call it…
-
2
votes1
answer75
viewsHow to add a description in the column?
I am using Firts Migration to update in MS SQL SERVER Database. In class ApplicationDBContext, has a method OnModelCreating where you can rename table, change data type, set your keys, etc... In…
-
2
votes2
answers52
viewsRandom key during user creation
In my migration of User owning: name, id, email and authorization key, however, I would like to know whether it is possible to authorization key is created randomly during user creation, this key…
-
2
votes1
answer1521
viewsFiles deleted by Django Migrations
I’m having a constant problem. As I am working with several branchs in a project, sometimes I go back in an old branch, bring updated branch to the old one so I don’t have to keep creating old bank…
-
2
votes1
answer31
viewsSettings Many to Many code fast Migration
good afternoon! I have this many configuration for many in my project. public class Usuario { public Usuario() { this.LocalTrabalho = new HashSet<LocalAtendimento>(); } public virtual…
-
2
votes0
answers143
viewsComposite key in Laravel migrate
I would like to create a double primary key with an auto increment field "id" and the "term", but it gives error and I do not know the correct way to do, if anyone can help me, I would appreciate it…
-
2
votes1
answer1146
viewsError While Creating Migration
I am creating a user register in C#, but when including the Domain layer and I will create the Migration is happening the error below. I haven’t been able to identify what happens. "No suitable…
-
2
votes3
answers5245
viewsRun a specific Migration on Laravel 5.6
I’m in need of executing only one migration within my system laravel, not to affect the rest of it. Excerpt from the Migration: public function up() { Schema::create('notifications', function…
-
1
votes1
answer203
viewsHow to publish . mdf database in Azure SQL Dabases?
I have a solution with a project Asp.Net MVC 5 and I’m using Code First and Migrations to update the database .mdf automatically generated in the App_data folder. How do I put this .mdf in the Azure…
-
1
votes1
answer456
viewsHow to do Migrations and versioning with Firebird database?
I recently found this site Flyway DB where, from what I understand, it is possible to create Migrations and control the version of the database. However, I don’t think it supports Firebird. Is there…
-
1
votes2
answers858
viewsProblem to run "Update-Database"
I’m following the tutorial of this video to set up an ASP.NET MVC project using Entityframework6. The database used in the tutorial is Sqlserver and what I’m trying to use is Mysql. I already have…
-
1
votes1
answer206
viewsArgument data type xml is invalid for argument 1 of Len Function
I am mapping a property to the xml database using Migrations. public string Xml { get; set; } this.Property(t => t.Xml).HasColumnName("Xml").HasColumnType("xml"); However, when consulting the…
-
1
votes0
answers213
viewsEnable-Migrations error in EF5 with Mysql
I have a problem in my project, when trying to enable Migrations in the project it generates an exception as below: > System.IO.FileLoadException: Could not load file or assembly…
-
1
votes1
answer4611
viewsHow to add a Foreign key with Migration?
I’m learning now how to use the Migrationof Laravel. I managed to understand well the functioning, but still do not know how to add a foreign_key I have the following Migration:…
-
1
votes1
answer92
viewsMigrations error c# MVC
I created a Finance Drive Controller, but when I click on the menu to list returns the error: Invalid Object name 'dbo. Move'. Why did that name stick? It was supposed to be Movimentacoes. PS: I…
-
1
votes1
answer616
viewsMigrations Hasmaxlength x Hascolumntype
I am creating a simple test table with EF Core e SQlite Follow the first test in which the modelbuilder creates a migration (shown just below) protected override void OnModelCreating(ModelBuilder…
-
1
votes1
answer373
viewsProblem with referential integrity in Migrations (Laravel 5)
I’m having a problem using onDelete('set null') in a foreign key. You are returning the error: [Illuminate Database Queryexception] SQLSTATE[HY000]: General error: 1215 Cannot add Foreign key…
-
1
votes1
answer173
viewsMigration in several tables with the same prefix
Is it possible with the Laravel to generate a migration that changes several tables with the same prefix? for example: in the tables pesquisas_187 and pesquisas_146 (tables that have the same…
-
1
votes0
answers149
viewsError generating Migration after changing a relationship
I’m having an error when changing a relationship Many to Many in the Entity framework I had 3 classes: Politics 1-n Politicabnormal n-1 Normative It turns out that I didn’t want to map this…
-
1
votes1
answer201
viewsHow to use Artisan make:Migration in a subdirectory with Laravel 5
I am starting to build an extremely robust application using Laravel 5 and need to organize all my table migration codes. My solution was to structure subfolders to facilitate the understanding and…
-
1
votes0
answers87
viewsRun a Migration by passing parameters on Laravel 5
I am creating a robust application where I will define which commands will be executed within a database according to the subdomain (which is also the name of the client’s database). How can I pass…
-
1
votes1
answer735
viewsMigration with possible data loss
When generating an update of db which results in possible data loss efcore shows the alert: An Operation was scaffolded that may result in the Oss of data. Please review the Migration for Accuracy.…
-
1
votes1
answer292
viewsCode First Relationship Migration and Insert?
I’m using UserManager to manage users, I am using migration and I’m having relationship trouble. I happen to have the entity Cliente: public class Cliente : IdentityUser { [NotMapped] public string…
-
1
votes0
answers130
viewsMigration with custom fields in Laravel
Accustomed to the existing Migration facilities in Asp.net MVC, I have the following question: Is there a way to create Fields in my Model and when running Migration the framework automatically…
-
1
votes1
answer967
viewsEntity Framework Core Error
I have an error with Entity Framework core when I add Migration, the following error appears to me: System.InvalidOperationException: Cannot use table 'Atleta' for entity type 'Pessoa' since it is…
-
1
votes1
answer610
viewsFill date Automatically in ASP.NET MVC 5
Hello, all right? I need some help from you, I already searched here on the forum but I was not successful with the results. I have a small application where I control Digital Certificates, my…
-
1
votes1
answer1780
viewsHow can I change the attribute of a column with Laravel Migrations
In my database I created using the Laravel Migrations I have a column called celphone which unfortunately did not add the attribute ->nullable() when I created it, now that the base is already in…