database-migration

django handwritten migrations altering auth

我们两清 提交于 2019-12-25 02:49:12
问题 I am using django 1.8.1 and trying to extend the length of auth_user name field from one of my apps. Before, with south, I could just target the app with an underscore like so: db.alter_column('auth_group', 'name', models.CharField(max_length=120, null=False, blank=False)) However, in django 1.8, I don't see a way to do this as django putts the app name in the sql withing the source code. I don't want to edit django source code so I have no way of changing that. my current attemp is here:

DataAnnotation Atributes not applied in EF7

自闭症网瘾萝莉.ら 提交于 2019-12-25 01:08:31
问题 When i migrate a database using k ef migration add bla bla. command the data annotation attributes are not reflected to the created database e.g. iam using the [MaxLength(2)] attribute and am getting a column with data type nvarchar(MAX) created Any help please 回答1: Data Annotations are not yet implemented in EF7. See issue #107. 来源: https://stackoverflow.com/questions/27924491/dataannotation-atributes-not-applied-in-ef7

How to recover from Entity Framework nightmare - database already has tables with the same name

我只是一个虾纸丫 提交于 2019-12-24 21:00:29
问题 How do you get EF back in Sync with code without losing data when Update-database returns the following message Error Message: System.Data.SqlClient.SqlException (0x80131904): There is already an object named '' in the database. 回答1: I originally wrote this as a self-answering question as I had struggled with the proble for some time, as had a few colleagues, but unfortunately, my answer was deleted and I can't recover it. Since it's a situation that I suspect can happen several times as

Data Migration From Multilevel XML to Single Table With SSIS

你。 提交于 2019-12-24 15:18:16
问题 Goal I am attempting to migrate data from a multi-layered XML file with nested elements to a single table. System Parameters MS SQL Server Management Studio Microsoft Visual Studio SSIS The XML File Here's the XSD for the XML file I have As you can see, it is not just a simple layout. The whole thing is wrapped in a 'People' tag, and there about ~1000 'Person's. Each 'Person' tag contains the following elements of information. The XML goes like this: Person FirstName LastName Biography

How can I programmatically set the 'target_metadata' required by Alembic for use with the command API?

自作多情 提交于 2019-12-24 12:00:35
问题 I'm managing database migrations with Alembic and would like to use the default files generated by alembic init without any modifications to env.py (e.g., setting target_metadata) or alembic.ini (e.g., setting sqlalchemy.url) to manage migrations of my database from scripts. For example, I'd like to use a command based script like the following: import os from alembic.config import Config from alembic import command from myapp import db alembic_cfg = Config(os.path.join(os.path.abspath(os

Data migration from Oracle 10g to Postgres db

a 夏天 提交于 2019-12-24 08:23:49
问题 I want to migrate the data from Oracle 10g database to Postgres db. Oracle SQL developer has data migration option but it seems its only for migrating non oracle db to oracle. Please let me know other options. 回答1: There's a dedicated tool for that written in Perl: Ora2Pg. Most databases provide tools for importing from other databases but not exporting to other databases. 回答2: I have tried using ORA2PG before but it was too complicated so I found my own way to migrate from sql developer to

Symfony Doctrine Migrations, how can I use multiple entity managers

喜你入骨 提交于 2019-12-24 03:56:06
问题 Using Symfony 2.5 and Doctrine 2.2, I have several databases for an application I'm working on, let's call one "Main" and the other "Secondary". There are currently two entity managers configured. In one migration I want to create a table in "Secondary" but it only wants to create the table in "Main." A migration can be ContainerAware, so I can get another EntityManager, but I have been unable to override the default one. Any able to help? Thanks in advance! 回答1: Just pass --em parameter when

DropColumn conditionally in a migration

ⅰ亾dé卋堺 提交于 2019-12-24 03:12:48
问题 I want to perform a column dropping in my Up migration. I am using EF 5. DropColumn("dbo.MyObjects", "AttributeId"); The issue is that in some way part of database instances do not have that column (long story how). I am thinking of dropping it with Sql and searching in sys.columns , or wrapping DropColumn in try ... catch . But maybe there is some known way to do it with Entity Framework migrations? 回答1: There was also a default constraint on my column, so ended up with the following: public

Is It Possible To Migrate From Realm To Sqlite?

你。 提交于 2019-12-24 02:41:58
问题 For some reasons(mainly large apk size even with ABI splits, anyway) i need to remove Realm completely and use Sqlite without losing data. I couldn't find a way. It seems the app must continue using Realm, or users will lost their data completely. Any idea will be appreciated 回答1: I don't think I understand fully what your problem is. If you are asking if there is a tool that will automate the data migration for you, then no, there is no such a tool. Otherwise it is rather straight forward:

Handling change in a database schema

£可爱£侵袭症+ 提交于 2019-12-24 00:47:30
问题 I am in the fairly initial stages of building an app which will hopefully be sold in the 1000's - more likely it'll be hundreds, but either way more than enough to cause a good sized headache for database schema changes. I'm rather restricted to a windows / .net / sql server environment as a number of our customers will be self hosting the app I'm building in their web servers and extra bits installed on their servers never goes well and there's always a number of complaints / lost business