chore(): Reorganize modules (#7210)
**What** Move all modules to the modules directory
This commit is contained in:
committed by
GitHub
parent
7a351eef09
commit
4eae25e1ef
@@ -0,0 +1,143 @@
|
||||
{
|
||||
"namespaces": [
|
||||
"public"
|
||||
],
|
||||
"name": "public",
|
||||
"tables": [
|
||||
{
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": false,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": false,
|
||||
"default": "'Medusa Store'",
|
||||
"mappedType": "text"
|
||||
},
|
||||
"supported_currency_codes": {
|
||||
"name": "supported_currency_codes",
|
||||
"type": "text[]",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": false,
|
||||
"default": "'{}'",
|
||||
"mappedType": "array"
|
||||
},
|
||||
"default_currency_code": {
|
||||
"name": "default_currency_code",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"default_sales_channel_id": {
|
||||
"name": "default_sales_channel_id",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"default_region_id": {
|
||||
"name": "default_region_id",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"default_location_id": {
|
||||
"name": "default_location_id",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"metadata": {
|
||||
"name": "metadata",
|
||||
"type": "jsonb",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"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"
|
||||
},
|
||||
"deleted_at": {
|
||||
"name": "deleted_at",
|
||||
"type": "timestamptz",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"length": 6,
|
||||
"mappedType": "datetime"
|
||||
}
|
||||
},
|
||||
"name": "store",
|
||||
"schema": "public",
|
||||
"indexes": [
|
||||
{
|
||||
"keyName": "IDX_store_deleted_at",
|
||||
"columnNames": [
|
||||
"deleted_at"
|
||||
],
|
||||
"composite": false,
|
||||
"primary": false,
|
||||
"unique": false,
|
||||
"expression": "CREATE INDEX IF NOT EXISTS \"IDX_store_deleted_at\" ON \"store\" (deleted_at) WHERE deleted_at IS NOT NULL"
|
||||
},
|
||||
{
|
||||
"keyName": "store_pkey",
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"composite": false,
|
||||
"primary": true,
|
||||
"unique": true
|
||||
}
|
||||
],
|
||||
"checks": [],
|
||||
"foreignKeys": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { Migration } from "@mikro-orm/migrations"
|
||||
|
||||
export class InitialSetup20240226130829 extends Migration {
|
||||
async up(): Promise<void> {
|
||||
// TODO: The migration needs to take care of moving data before dropping columns, among other things
|
||||
const storeTables = await this.execute(
|
||||
"select * from information_schema.tables where table_name = 'store' and table_schema = 'public'"
|
||||
)
|
||||
|
||||
if (storeTables.length > 0) {
|
||||
this.addSql(`alter table "store" alter column "id" TYPE text;`)
|
||||
this.addSql(`alter table "store" alter column "name" TYPE text;`)
|
||||
this.addSql(
|
||||
`alter table "store" alter column "name" SET DEFAULT 'Medusa Store';`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table "store" alter column "default_currency_code" TYPE text;`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table "store" alter column "default_currency_code" drop not null;`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table "store" alter column "default_sales_channel_id" TYPE text;`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table "store" alter column "default_location_id" TYPE text;`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`alter table "store" add column "default_region_id" text null;`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table "store" add column "deleted_at" timestamptz null;`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table "store" add column "supported_currency_codes" text[] not null default \'{}\';`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
'create index if not exists "IDX_store_deleted_at" on "store" (deleted_at) where deleted_at is not null;'
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`alter table "store" drop constraint if exists "FK_61b0f48cccbb5f41c750bac7286";`
|
||||
)
|
||||
this.addSql(
|
||||
`alter table "store" drop constraint if exists "FK_55beebaa09e947cccca554af222";`
|
||||
)
|
||||
|
||||
// this.addSql(`alter table "store" drop column "default_currency_code";`)
|
||||
// this.addSql(`alter table "store" drop column "swap_link_template";`)
|
||||
// this.addSql(`alter table "store" drop column "payment_link_template";`)
|
||||
// this.addSql(`alter table "store" drop column "invite_link_template";`)
|
||||
} else {
|
||||
this.addSql(`create table if not exists "store"
|
||||
("id" text not null, "name" text not null default \'Medusa Store\', "supported_currency_codes" text[] not null default \'{}\',
|
||||
"default_currency_code" text null, "default_sales_channel_id" text null, "default_region_id" text null, "default_location_id" text null,
|
||||
"metadata" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null,
|
||||
constraint "store_pkey" primary key ("id"));`)
|
||||
|
||||
this.addSql(
|
||||
'create index if not exists "IDX_store_deleted_at" on "store" (deleted_at) where deleted_at is not null;'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user