Backwards migration with Django South

You need to figure out the number of the migration just before the one you want to roll back. Your app should have a migrations directory, with files in it named like 0000_initial.py 0001_added_some_fields.py 0002_added_some_more_fields.py 0003_deleted_some_stuff.py Normally, when you run ./manage.py migrate your_app, South runs all new migrations, in order. (It looks at the database … Read more

Migration: Cannot add foreign key constraint

Add it in two steps, and it’s good to make it unsigned too: public function up() { Schema::create(‘priorities’, function($table) { $table->increments(‘id’, true); $table->integer(‘user_id’)->unsigned(); $table->string(‘priority_name’); $table->smallInteger(‘rank’); $table->text(‘class’); $table->timestamps(‘timecreated’); }); Schema::table(‘priorities’, function($table) { $table->foreign(‘user_id’)->references(‘id’)->on(‘users’); }); }

Version of SQLite used in Android?

Here is a link to the official docs which include the main points in this answer: android.database.sqlite package-level javadoc Kotlin code to get framework SQLite version (tip: just stick a breakpoint in your Activity onCreate() and use this code in Evaluate Expression…): val version = android.database.sqlite.SQLiteDatabase.create(null).use { android.database.DatabaseUtils.stringForQuery(it, “SELECT sqlite_version()”, null) } “Framework (API ${android.os.Build.VERSION.SDK_INT}) … Read more

Run a single migration file

Assuming fairly recent version of Rails you can always run: rake db:migrate:up VERSION=20090408054532 Where version is the timestamp in the filename of the migration. Edit: At some point over the last 8 years (I’m not sure what version) Rails added checks that prevent this from running if it has already been run. This is indicated … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)