fix: Tax region + rates clean up (#9279)
What - Require `code` on Tax Rates - Update dashboard to account for non-nullable code on Tax Rates - Include `automatic_taxes` in API Route response Closes CC-524 CC-525
This commit is contained in:
@@ -246,7 +246,7 @@
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"nullable": false,
|
||||
"mappedType": "float"
|
||||
},
|
||||
"code": {
|
||||
@@ -255,7 +255,7 @@
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"nullable": false,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"name": {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Migration } from "@mikro-orm/migrations"
|
||||
|
||||
export class Migration20240924114005 extends Migration {
|
||||
async up(): Promise<void> {
|
||||
this.addSql(
|
||||
`UPDATE "tax_rate" SET code = 'default' WHERE code IS NULL;`
|
||||
)
|
||||
this.addSql(
|
||||
`ALTER TABLE IF EXISTS "tax_rate" ALTER COLUMN "code" SET NOT NULL;`
|
||||
)
|
||||
}
|
||||
|
||||
async down(): Promise<void> {
|
||||
this.addSql(
|
||||
`ALTER TABLE IF EXISTS "tax_rate" ALTER COLUMN "code" DROP NOT NULL;`
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -61,8 +61,8 @@ export default class TaxRate {
|
||||
rate: number | null = null
|
||||
|
||||
@Searchable()
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
code: string | null = null
|
||||
@Property({ columnType: "text" })
|
||||
code: string
|
||||
|
||||
@Searchable()
|
||||
@Property({ columnType: "text" })
|
||||
|
||||
Reference in New Issue
Block a user