database-migration

impdp in Oracle. Why it does not create users?

左心房为你撑大大i 提交于 2019-12-10 13:45:15
问题 I am newbie in oracle and I am facing troubles with impdp . I have a production server and I have created a new server for testing purposes, so I installed centos, oracle and created the database "sire" . Now I make a dump from the production server with the following command: expdp system/password@sire full=Y directory=pump_dir dumpfile=sire_dump.dmp logfile=sire.log The I come to the new server, and I execute impdp: impdp system/password@sire full=Y directory=pump_directorio dumpfile=sire

alembic create_table, check if table exists

青春壹個敷衍的年華 提交于 2019-12-10 13:38:18
问题 I have an alembic upgrade script that creates a table, however I don't want it to create the table if it already exists. According to the alembic doc, I can pass in keyword args to op.create_tables that are acceptable to sqlalchemy.schema.table, so I'm using the keep_existing keyword: op.create_table('foo_model', sa.Column('foo_id', sa.Integer(), nullable=False), sa.Column('foo_str', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('foo_id'), keep_existing= True ) However I'm

Change foreign key column name in rails

浪子不回头ぞ 提交于 2019-12-10 12:44:15
问题 I have a Project migration class like this: class CreateProjects < ActiveRecord::Migration def change create_table :projects do |t| t.string :title t.text :description t.boolean :public t.references :user, index: true, foreign_key: true t.timestamps null: false end end end It creates a column name user_id in projects table but I want to name the column owner_id so I can use project.owner instead of project.user . 回答1: You can do it two ways: #app/models/project.rb class Project < ActiveRecord

Why this database migration error after I upgrade my version django-mptt?

落花浮王杯 提交于 2019-12-10 12:31:15
问题 My Django application has a requirements.txt file (shown here) that I use to install modules in my virtual environment. Everything works fine. However, I'm now trying to upgrade django-mptt from 0.6.1 to the latest version. (I actually don't care to upgrade django-mptt. I just want to upgrade my version of Django. But it seems to upgrade Django, I must first upgrade django-mptt as described here). So I do pip install -U django-mptt . This causes django-mptt to go from 0.6.1 to 0.7.4 and

How to drop and recreate all tables on DB version update in ActiveAndroid?

*爱你&永不变心* 提交于 2019-12-10 11:25:49
问题 I'm using ActiveAndroid in my application as the Database system. At current stage I don't want to write the migration files for migrating current tables to altered ones for when I update DB version. Instead what I want to do is to drop all tables and recreate a new set of tables. Unfortunately from digging in the ActiveAndroid the Database version test happens at initialization stage in which I pass a ActiveAndroid Configuration object to configure the Database . At this point their

How to use flyway to migrate data from one DB to another DB?

微笑、不失礼 提交于 2019-12-10 10:56:52
问题 I have two postgreSql DB on different server lets say A and B. Can I use flyway some how to copy all data from DB A to B which is newly setup and empty. Its will be helpful if anyone point me to correct direction and tool, requirement is to copy data from one DB to another through some tool automation huge data volume need to consider in solution. 回答1: Flyway doesn't directly support such a capability. However, you could do the following: As Laurenz says, use pg_dump to extract DB A into a

Knex Migration Postgres Heroku - Error: Unable to Acquire Connection

时间秒杀一切 提交于 2019-12-10 10:18:16
问题 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

How to migrate an Openerp v7 database to Odoo v8?

我与影子孤独终老i 提交于 2019-12-10 09:46:01
问题 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? 回答1: 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

How to gracefully handle “Mysql2::Error: Invalid date” in ActiveRecord?

本秂侑毒 提交于 2019-12-09 21:55:04
问题 I'm building a Rails 3.2 app upon a legacy database which also has some broken records in different tables. One of the issues giving the most headache is that it includes invalid dates. I've setup a sandbox which I manually fixed one time to get my code working. Now it's time for deployment. For this reason, the sandbox is reset every night and copied from the live database, ferret indexes are rebuilt, and migrations are re-applied. We are going to deploy to the sandbox often to get in the

Timeout on advisory locks in postgresql

蓝咒 提交于 2019-12-09 09:03:43
问题 I'm migrating from ORACLE. Currently I'm trying to port this call: lkstat := DBMS_LOCK.REQUEST(lkhndl, DBMS_LOCK.X_MODE, lktimeout, true); This function tries to acquire lock lkhndl and returns 1 if it fails to get it after timeout seconds. In postgresql I use pg_advisory_xact_lock(lkhndl); However, it seems that it waits for lock forever. pg_try_advisory_xact_lock returns immediately if fails. Is there a way to implement timeout version of lock acquiring? There is lock_timeout setting, but I