database-migration

Could not find driver while migrating on Laravel 4 using XAMPP Server Linux (Ubuntu)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 07:01:40
问题 I have installed Laravel 4.1 everything worked just fine, but when I try to use migration it throws a PDO Exception saying: [PDOException] could not find driver I found many answers on StackOverFlow, but none of them solved my problem, unfortunately. I have tried to enable pdo extension and pdo_mysql extension, but it says that pdo is already loaded. I have tried to reinstall PDO and PDO MySQL but nothing worked. I am using XAMPP Server on a Ubuntu 64bit machine. Thank you in advance. 回答1: If

How to add computed column using migrations in code first?

邮差的信 提交于 2019-12-06 06:21:20
I have added this computed column inside my data model [DatabaseGenerated(DatabaseGeneratedOption.Computed)] public string FullName { get; private set; } After that I created it inside my database using this query ALTER TABLE [MyDataBase].[dbo].[User] ADD FullName as ([FirstName] + ' ' + [LastName]) When I run my code I get an error that my database has changed . My question How to create migration for this computed column (because it's already created using sql query) Entity Framework doesn't know how to properly handle migrations for computed columns, so you need to help it out. Firstly,

There is already an object named '__MigrationHistory' in the database

二次信任 提交于 2019-12-06 06:03:15
问题 When I tried to execute SQLQuery (generated by Update-Database -Verbose -f -Script locally in Visual Studio) on remote database, I saw the following error returned by SQL Server Management Studio: Msg 2714, Level 16, State 6, Line 1 There is already an object named '__MigrationHistory' in the database. How to solve this? 回答1: __MigrationHistory is an auto-generated table used by EF to track what upgrades/patches it has applied to the database. EF is completely aware of that table and handles

Usefulness of db migrations rollback

倖福魔咒の 提交于 2019-12-06 01:57:11
Many people talking about db migrations, especially about its rollback possibility. I doubt, whether it is useful at all, because schema of db and model are tightly connected with application logic (MVC). Suppose i've done rollback of some migration. And what ? The application will not work, because its logic fully relies on db. What are the use cases of rollback ability for db migrations ? Update 1 The main question Why the rollback is presented as a feature, when i need to change the code ? I don't create the migrations, like "add_another_field_to_table". Instead, each migration file fully

Play framework 2.4.3 evolutions not triggered

吃可爱长大的小学妹 提交于 2019-12-05 23:56:38
I'm doing the todo tutorial of Play. When I created the evolution in conf/evolutions/default/1.sql nothing happens. I just get the Exception JdbcSQLException: Table "TASK" not found which makes sense. I applied the evolution manually to the DB with h2-browser in activator console and after that it works. But the evolutions don't show up automatically. application.conf # Database configuration # ~~~~~ # You can declare as many datasources as you want. # By convention, the default datasource is named `default` # db.default.driver=org.h2.Driver db.default.url="jdbc:h2:mem:play" db.default

How to remove an app from a django projects (and all its tables)

时光毁灭记忆、已成空白 提交于 2019-12-05 21:56:46
问题 I want to remove an app from a django project. I want to remove the tables of the app the content-types foreign-key usages of these content-types Running manage.py migrate app_to_remove zero does not work: django.db.migrations.migration.IrreversibleError: Operation <RunPython <function forwards_func at 0x7ff76075d668>> in fooapp.0007_add_bar is not reversible I guess there are several migrations which are not reversible ... 回答1: First: Remove references in the code remove app_to_remove from

Entity Framework 5 - Migrations and creating table from entity

情到浓时终转凉″ 提交于 2019-12-05 21:39:56
I am using Entity Framework 5 RC and i have some code that require a specific table on the database. The entity is already created using Code-First. a) Is there a way to tell EF to create the table if its not already created in the database ? If yes.. how ? b) Also.. if the table already exist, can it handle entity changes such adding properties to the entity.. will it get reflected on the database ? (We still use the code-first approach here) Thanks! Ladislav Mrnka Use code first migrations (either automatic or code based ). If you are adding table to existing database create initial

Knex Migration Postgres Heroku - Error: Unable to Acquire Connection

回眸只為那壹抹淺笑 提交于 2019-12-05 19:59:59
I am trying to run my first migration which creates a single table in a heroku postgres database. When I try to run knex migrate:latest --env development I receive the error Error: Unable to acquire a connection . Things I've tried: adding ?ssl=true to the end of my connection string stored in process.env.LISTINGS_DB_URL as I'm aware this is sometimes a requirement to connect with heroku setting the env variable PGSSLMODE=require I also stumbled across this article where someone has commented that knex will not accept keys based on environment. However, I'm attempting to follow along with this

How to migrate an Openerp v7 database to Odoo v8?

筅森魡賤 提交于 2019-12-05 19:53:38
I have a dump file of database backup(openerp-7). Now I want to continue my work in Odoo, the database is in openerp-7 format so I am not able to restore it in Odoo. How to convert this database to Odoo version in order to start working on it? You must do a data migration. That's not an easy task. You can use some of this migration tools: OpenUpgrade . Or you can use some ETL tool such as Odoo ETL If you only want migrate some table you can export it in a CSV file and import it in Odoo choosing the right columns. Using pgadmin3,we can export the tables and import in our desired database of

Entity Framework 4.3.1 migrations always invokes default constructor and ignores connectionstring

做~自己de王妃 提交于 2019-12-05 18:26:16
I want to execute (code-first) migrations using a connectionString that I have constructed myself. The entry point is a static function with one parameter, the connectionString. I have a DbContext class called PocModel with both a default constructor. public PocModel() : base("PocModel") { ... And a context constructor with a string argument: public PocModel(string nameOrConnectionString): base(nameOrConnectionString) { ... My goal is to perform migrations on the database that is targeted by the connectionString, not the connectionString that EF "magically" creates via the name only (localhost