database-migration

How can indexes be checked if they exist in a Laravel migration?

一个人想着一个人 提交于 2020-01-01 08:35:23
问题 Trying to check if a unique index exists on a table when preparing a migration, how can it be achieved? Schema::table('persons', function (Blueprint $table) { if ($table->hasIndex('persons_body_unique')) { $table->dropUnique('persons_body_unique'); } }) Something that looks like the above. (apparently, hasIndex() doesn't exist) 回答1: Using "doctrine-dbal" that Laravel uses is better solution: Schema::table('persons', function (Blueprint $table) { $sm = Schema::getConnection()-

Stop Django from creating migrations if the list of choices of a field changes

余生长醉 提交于 2020-01-01 04:06:09
问题 I have a django core app called "foocore". There are several optional pluging-like apps. For example "superfoo". In my case every plugin adds a new choice in a model CharField which belongs to "foocore". Django migrations detect changes if the list of choices get changed. I think this is not necessary. At least one other developer thinks the same: https://code.djangoproject.com/ticket/22837 class ActivePlugin(models.Model): plugin_name = models.CharField(max_length=32, choices=get_active

Gradually migrate from SQL Server to PostgreSQL

試著忘記壹切 提交于 2020-01-01 03:37:21
问题 Company has numerous applications running on SQL Server. The database is a bit of a mess. The goal is to gradually move from SQL Server to PostgreSQL (another SQL Server instance is not an option) An ideal scenario would be if new applications could connect to PostgreSQL, create a new table structure, but still be able to use/interact with data from legacy SQL Server (an app connecting to two database servers is not an option). Foreign data wrappers do not seem to be an option, since the

django 1.7 migrations — how do I clear all migrations and start over from scratch?

落花浮王杯 提交于 2019-12-31 08:06:05
问题 So I'm rapidly iterating on a django app at the moment and I'm constantly adjusting models.py. Over the course of a day or two of programming and testing I generate a couple dozen migration files. Sometimes I really tear the schema apart and completely re-do it. This causes the migration process to complain a great deal about defaults and null values and so on. If possible, I would just like to scratch all the migration stuff and re-start the migrations now that I finally know what I'm doing.

IOException when I try to start Liferay after migration from HSQL to PostgreSQL

一世执手 提交于 2019-12-31 06:56:25
问题 I converted native lportal DB from Hypersonic to PostgreSQL. Added portal-ext.properties files with my PostgreSQL configurations and added postgresql-42.1.1 to D:\files\liferay-ce-portal-7.0-ga3\tomcat-8.0.32\lib\ext # PostgreSQL # jdbc.default.driverClassName=org.postgresql.Driver jdbc.default.url=jdbc:postgresql://localhost:5432/test jdbc.default.username=postgres jdbc.default.password=root And when I'm starting my liferay it shows me an Exception. But If I remove portal-ext.properties it

How to bind migrations with executable

北慕城南 提交于 2019-12-31 01:40:09
问题 I have a Go project using goose for Mysql migrations. I would like to bind the migrations to the package executable so that the executable can be deployed and used independently from any system, similar to JAR files in JAVA projects. Is there an equivalent in Go to accomplish that? 回答1: How to get a single file which can migrate database and work Install go get -u github.com/pressly/goose/cmd/goose Make app. I base it on example main.go and add run option. Suppose your project is located at

Flyway and liquibase together? [closed]

浪子不回头ぞ 提交于 2019-12-30 00:28:27
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I've looked at both Liquibase and Flyway individually and on an individual comparison alone, Liquibase seems like the better tool for our needs. Some sources mention using both Liquibase and Flyway together. Liquibase seems to have everything Flyway has and more flexibility when it

No changes detected in Alembic autogeneration of migrations with Flask-SQLAlchemy

跟風遠走 提交于 2019-12-29 20:17:12
问题 I'm having trouble getting Alembic to autogenerate candidate migrations from changes to classes using db.Model (Flask-SQLAlchemy) instead of Base . I've modified env.py to create my Flask app, import all relevant models, initialize the database, and then run migrations: ... uri = 'mysql://user:password@host/dbname?charset=utf8' app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = uri app.config['SQLALCHEMY_ECHO'] = True db.init_app(app) with app.test_request_context(): target

Yii Framework - yic migrate command doesn't work

﹥>﹥吖頭↗ 提交于 2019-12-25 05:24:16
问题 I am trying to create a table using Yii db migration in safeUp() method. However, when I use the "./yiic migrate" command, it runs successfully but the table doesn't appear in the database. The following is code from the migration file: <?php class m130808_123826_test_table extends CDbMigration { public function up() { } public function down() { echo "m130808_123826_test_table does not support migration down.\n"; return false; } public function safeUp() { $this->createTable('tbl_test', array(

Any tools for Understanding Existing Foxpro Database Model?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 03:56:30
问题 I have some dbf files of foxpro database. However, I have no idea about what are relationship between tables regarding foreign key, what tables are inter related and so on. Is there any tool which can help me to learn relationships easily. I mean which can draw relationship instead of me figuring out by hit and try.? I want to export this database to Microsoft SQL Server. So I want to learn whole database schema to learn tables logic. Thanks 回答1: Is this just a set of VFP free tables or is