@lomray/microservice-payment-stripe
Version:
Stripe payment microservice based on NodeJS & inverted json.
28 lines (24 loc) • 1.88 kB
JavaScript
'use strict';
var tslib = require('tslib');
class cart1698656203251 {
constructor() {
this.name = 'cart1698656203251';
}
up(queryRunner) {
return tslib.__awaiter(this, void 0, void 0, function* () {
yield queryRunner.query(`CREATE TABLE "cart" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userId" character varying(36), "params" json NOT NULL DEFAULT '{}', "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "cart(pk):id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE TABLE "cart_product_price" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "cartId" uuid NOT NULL, "priceId" character varying NOT NULL, "quantity" integer NOT NULL DEFAULT '1', "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "cart_product_price(pk):id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`ALTER TABLE "cart_product_price" ADD CONSTRAINT "cart_product_price(fk):cartId" FOREIGN KEY ("cartId") REFERENCES "cart"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
yield queryRunner.query(`ALTER TABLE "cart_product_price" ADD CONSTRAINT "cart_product_price(fk):priceId" FOREIGN KEY ("priceId") REFERENCES "price"("priceId") ON DELETE NO ACTION ON UPDATE NO ACTION`);
});
}
down(queryRunner) {
return tslib.__awaiter(this, void 0, void 0, function* () {
yield queryRunner.query(`ALTER TABLE "cart_product_price" DROP CONSTRAINT "cart_product_price(fk):priceId"`);
yield queryRunner.query(`ALTER TABLE "cart_product_price" DROP CONSTRAINT "cart_product_price(fk):cartId"`);
yield queryRunner.query(`DROP TABLE "cart_product_price"`);
yield queryRunner.query(`DROP TABLE "cart"`);
});
}
}
module.exports = cart1698656203251;