From 9cbe26193873260f936f1e3acf214d00b275bfff Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sat, 11 Nov 2023 00:13:43 +1300 Subject: [PATCH] =?UTF-8?q?Fix=20error=20creating=20new=20plans=20-=201.17?= =?UTF-8?q?3=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 4 +-- data-source.ts | 2 ++ migrations/1699613077628-exercises-fix.ts | 43 +++++++++++++++++++++++ package.json | 2 +- 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 migrations/1699613077628-exercises-fix.ts diff --git a/android/app/build.gradle b/android/app/build.gradle index 61193ca..2eee223 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -85,8 +85,8 @@ android { applicationId "com.massive" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 36198 - versionName "1.172" + versionCode 36199 + versionName "1.173" } signingConfigs { release { diff --git a/data-source.ts b/data-source.ts index 8d5735e..1845b5d 100644 --- a/data-source.ts +++ b/data-source.ts @@ -31,6 +31,7 @@ import { Plan } from "./plan"; import Settings from "./settings"; import Weight from "./weight"; import { exercises1699508495726 } from "./migrations/1699508495726-exercises"; +import { exercisesFix1699613077628 } from "./migrations/1699613077628-exercises-fix"; export const AppDataSource = new DataSource({ type: "react-native", @@ -68,5 +69,6 @@ export const AppDataSource = new DataSource({ planTitle1692654882408, weight1697766633971, exercises1699508495726, + exercisesFix1699613077628, ], }); diff --git a/migrations/1699613077628-exercises-fix.ts b/migrations/1699613077628-exercises-fix.ts new file mode 100644 index 0000000..69bf0cf --- /dev/null +++ b/migrations/1699613077628-exercises-fix.ts @@ -0,0 +1,43 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class exercisesFix1699613077628 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + CREATE TABLE plans_temp ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + days TEXT NOT NULL, + workouts TEXT NOT NULL, + title TEXT + ) + `); + + await queryRunner.query(` + INSERT INTO plans_temp (id,days,workouts,title) + SELECT id,days,workouts,title + FROM plans + `); + + await queryRunner.query(` + DROP TABLE plans + `); + + await queryRunner.query(` + CREATE TABLE plans ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + days TEXT NOT NULL, + exercises TEXT NOT NULL, + title TEXT + ) + `); + + await queryRunner.query(` + INSERT INTO plans (id,days,exercises,title) + SELECT id,days,workouts,title + FROM plans_temp + `); + + await queryRunner.query(`DROP TABLE plans_temp`); + } + + public async down(queryRunner: QueryRunner): Promise {} +} diff --git a/package.json b/package.json index bfb13ec..834cafb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "massive", - "version": "1.172", + "version": "1.173", "private": true, "license": "GPL-3.0-only", "scripts": {