fix(modules-sdk): Remote Query "order" as config options (#6925)

This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2024-04-08 08:17:53 +02:00
1 parent 4f88743591
commit dd35a4dbff
8 files changed
+93 -40

No files matched your search

@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -70,6 +68,28 @@
"primary": false,
"nullable": false,
"mappedType": "json"
},
"created_at": {
"name": "created_at",
"type": "timestamptz",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"length": 6,
"default": "now()",
"mappedType": "datetime"
},
"updated_at": {
"name": "updated_at",
"type": "timestamptz",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"length": 6,
"default": "now()",
"mappedType": "datetime"
}
},
"name": "currency",
@@ -77,9 +97,7 @@
"indexes": [
{
"keyName": "currency_pkey",
"columnNames": [
"code"
],
"columnNames": ["code"],
"composite": false,
"primary": true,
"unique": true
@@ -2,24 +2,27 @@ import { Migration } from "@mikro-orm/migrations"
export class InitialSetup20240228133303 extends Migration {
async up(): Promise<void> {
const currencyTables = await this.execute(
"select * from information_schema.tables where table_name = 'currency' and table_schema = 'public'"
)
this.addSql(`
create table if not exists "currency"
(
"code" text not null,
"symbol" text not null,
"symbol_native" text not null,
"decimal_digits" int not null default 0,
"rounding" numeric not null default 0,
"raw_rounding" jsonb not null,
"name" text not null,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NOT NULL DEFAULT now(),
constraint "currency_pkey" primary key ("code")
);
if (currencyTables.length > 0) {
// This is so we can still run the api tests, remove completely once that is not needed
this.addSql(
`alter table "currency" add column "decimal_digits" int not null default 0;`
)
this.addSql(
`alter table "currency" add column "rounding" numeric not null default 0;`
)
this.addSql(`alter table "currency" add column "raw_rounding" jsonb;`)
}
ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "created_at" TIMESTAMPTZ NOT NULL DEFAULT now();
ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "updated_at" TIMESTAMPTZ NULL DEFAULT now();
this.addSql(`create table if not exists "currency"
("code" text not null, "symbol" text not null, "symbol_native" text not null, "name" text not null,
"decimal_digits" int not null default 0, "rounding" numeric not null default 0, "raw_rounding" jsonb not null,
constraint "currency_pkey" primary key ("code"));`)
ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "decimal_digits" int not null default 0;
ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "rounding" numeric not null default 0;
ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "raw_rounding" jsonb;
`)
}
}
+15
View File
@@ -24,6 +24,21 @@ class Currency {
@Property({ columnType: "jsonb" })
raw_rounding: BigNumberRawValue
@Property({
onCreate: () => new Date(),
columnType: "timestamptz",
defaultRaw: "now()",
})
created_at: Date
@Property({
onCreate: () => new Date(),
onUpdate: () => new Date(),
columnType: "timestamptz",
defaultRaw: "now()",
})
updated_at: Date
}
export default Currency