Skip to content

Instantly share code, notes, and snippets.

@adevinwild
Created December 29, 2022 18:55
Show Gist options
  • Save adevinwild/7a47848853679705163cb19faff365c5 to your computer and use it in GitHub Desktop.
Save adevinwild/7a47848853679705163cb19faff365c5 to your computer and use it in GitHub Desktop.
UserMigration for Medusa
import { Migration } from "medusa-extender";
import { MigrationInterface, QueryRunner } from "typeorm";
@Migration()
export default class addStoreIdToUser1672134240438
implements MigrationInterface
{
name = "addStoreIdToUser1672134240438";
public async up(queryRunner: QueryRunner): Promise<void> {
const query = `ALTER TABLE public."user" ADD COLUMN IF NOT EXISTS "store_id" text;`;
await queryRunner.query(query);
}
public async down(queryRunner: QueryRunner): Promise<void> {
const query = `ALTER TABLE public."user" DROP COLUMN "store_id";`;
await queryRunner.query(query);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment