@zimpligital/medusa-plugin-auth-otp
Version:
A starter for Medusa plugins.
15 lines • 1.77 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Migration20250310061940 = void 0;
const migrations_1 = require("@mikro-orm/migrations");
class Migration20250310061940 extends migrations_1.Migration {
async up() {
this.addSql(`create table if not exists "otp_requests" ("id" text not null, "country_code" text null, "phone" text null, "otp_hash" text not null, "ref_code" text not null, "expired_at" timestamptz not null, "attempts" integer not null default 0, "status" text check ("status" in ('initiated', 'pending', 'failed', 'verified', 'exceeded_attempts', 'overridden')) not null default 'initiated', "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "otp_requests_pkey" primary key ("id"));`);
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_otp_requests_deleted_at" ON "otp_requests" (deleted_at) WHERE deleted_at IS NULL;`);
}
async down() {
this.addSql(`drop table if exists "otp_requests" cascade;`);
}
}
exports.Migration20250310061940 = Migration20250310061940;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAzMTAwNjE5NDAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9hdXRoLW90cC9taWdyYXRpb25zL01pZ3JhdGlvbjIwMjUwMzEwMDYxOTQwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHNEQUFrRDtBQUVsRCxNQUFhLHVCQUF3QixTQUFRLHNCQUFTO0lBRTNDLEtBQUssQ0FBQyxFQUFFO1FBQ2YsSUFBSSxDQUFDLE1BQU0sQ0FBQyxrakJBQWtqQixDQUFDLENBQUM7UUFDaGtCLElBQUksQ0FBQyxNQUFNLENBQUMsbUhBQW1ILENBQUMsQ0FBQztJQUNuSSxDQUFDO0lBRVEsS0FBSyxDQUFDLElBQUk7UUFDakIsSUFBSSxDQUFDLE1BQU0sQ0FBQyw4Q0FBOEMsQ0FBQyxDQUFDO0lBQzlELENBQUM7Q0FFRjtBQVhELDBEQVdDIn0=