-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
upalinski
committed
Oct 22, 2024
1 parent
f52ee07
commit f79abf6
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = class Data1729597576693 { | ||
name = 'Data1729597576693' | ||
|
||
async up(db) { | ||
await db.query(`CREATE TABLE "ddc_customer_deposit" ("id" character varying NOT NULL, "block_timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "amount" numeric NOT NULL, "account_id_id" character varying, CONSTRAINT "PK_06d927aee2abc69652853515725" PRIMARY KEY ("id"))`) | ||
await db.query(`CREATE INDEX "IDX_5f688e078889917be4732ade71" ON "ddc_customer_deposit" ("account_id_id") `) | ||
await db.query(`CREATE INDEX "IDX_8736430cd5c9f0802ab319c412" ON "ddc_customer_deposit" ("block_timestamp", "amount") `) | ||
await db.query(`CREATE TABLE "ddc_customer_charge" ("id" character varying NOT NULL, "block_timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "amount" numeric NOT NULL, "account_id_id" character varying, CONSTRAINT "PK_8ea116156bd184ae6562ab4ec1c" PRIMARY KEY ("id"))`) | ||
await db.query(`CREATE INDEX "IDX_dd29caa38eb21330313a488320" ON "ddc_customer_charge" ("account_id_id") `) | ||
await db.query(`CREATE INDEX "IDX_6e14d7e766037ec89c1f64a9a4" ON "ddc_customer_charge" ("block_timestamp", "amount") `) | ||
await db.query(`ALTER TABLE "ddc_customer_deposit" ADD CONSTRAINT "FK_5f688e078889917be4732ade716" FOREIGN KEY ("account_id_id") REFERENCES "account"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) | ||
await db.query(`ALTER TABLE "ddc_customer_charge" ADD CONSTRAINT "FK_dd29caa38eb21330313a4883208" FOREIGN KEY ("account_id_id") REFERENCES "account"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) | ||
} | ||
|
||
async down(db) { | ||
await db.query(`DROP TABLE "ddc_customer_deposit"`) | ||
await db.query(`DROP INDEX "public"."IDX_5f688e078889917be4732ade71"`) | ||
await db.query(`DROP INDEX "public"."IDX_8736430cd5c9f0802ab319c412"`) | ||
await db.query(`DROP TABLE "ddc_customer_charge"`) | ||
await db.query(`DROP INDEX "public"."IDX_dd29caa38eb21330313a488320"`) | ||
await db.query(`DROP INDEX "public"."IDX_6e14d7e766037ec89c1f64a9a4"`) | ||
await db.query(`DROP INDEX "public"."IDX_32e2c1d3ddd2960a09dc90c9ea"`) | ||
await db.query(`ALTER TABLE "ddc_customer_deposit" DROP CONSTRAINT "FK_5f688e078889917be4732ade716"`) | ||
await db.query(`ALTER TABLE "ddc_customer_charge" DROP CONSTRAINT "FK_dd29caa38eb21330313a4883208"`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_, DateTimeColumn as DateTimeColumn_, ManyToOne as ManyToOne_, BigIntColumn as BigIntColumn_} from "@subsquid/typeorm-store" | ||
import {Account} from "./account.model" | ||
|
||
@Index_(["blockTimestamp", "amount"], {unique: false}) | ||
@Entity_() | ||
export class DdcCustomerCharge { | ||
constructor(props?: Partial<DdcCustomerCharge>) { | ||
Object.assign(this, props) | ||
} | ||
|
||
@PrimaryColumn_() | ||
id!: string | ||
|
||
@DateTimeColumn_({nullable: false}) | ||
blockTimestamp!: Date | ||
|
||
@Index_() | ||
@ManyToOne_(() => Account, {nullable: true}) | ||
accountId!: Account | ||
|
||
@BigIntColumn_({nullable: false}) | ||
amount!: bigint | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, Index as Index_, DateTimeColumn as DateTimeColumn_, ManyToOne as ManyToOne_, BigIntColumn as BigIntColumn_} from "@subsquid/typeorm-store" | ||
import {Account} from "./account.model" | ||
|
||
@Index_(["blockTimestamp", "amount"], {unique: false}) | ||
@Entity_() | ||
export class DdcCustomerDeposit { | ||
constructor(props?: Partial<DdcCustomerDeposit>) { | ||
Object.assign(this, props) | ||
} | ||
|
||
@PrimaryColumn_() | ||
id!: string | ||
|
||
@DateTimeColumn_({nullable: false}) | ||
blockTimestamp!: Date | ||
|
||
@Index_() | ||
@ManyToOne_(() => Account, {nullable: true}) | ||
accountId!: Account | ||
|
||
@BigIntColumn_({nullable: false}) | ||
amount!: bigint | ||
} |