Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: seed-company import

Brad Barbin815a621c3681
diff --git a/ci/src/migrations.ts b/ci/src/migrations.ts
index 762637203a..b9be677770 100644
--- a/ci/src/migrations.ts
+++ b/ci/src/migrations.ts
@@ -40,6 +40,7 @@ async function migrate(): Promise<void> {
console.log("👯‍♀️ Copying supabase folder");
await $`cp -r ../packages/database/supabase .`;
+ await $`cp -r ../packages/database/src .`;
for await (const workspace of workspaces as Workspace[]) {
try {
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 107a2600e6..2f82a5f073 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -48680,14 +48680,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/lib/seed.ts b/packages/database/supabase/functions/lib/seed.ts
new file mode 100644
index 0000000000..6cb7b46298
--- /dev/null
+++ b/packages/database/supabase/functions/lib/seed.ts
@@ -0,0 +1,34 @@
+/**
+ * Deno-compatible re-export of seed data for edge functions.
+ * Source of truth is packages/database/src/seed/seed.data.ts
+ */
+
+export {
+ accountCategories,
+ accountDefaults,
+ accounts,
+ currencies,
+ customerStatuses,
+ failureModes,
+ fiscalYearSettings,
+ gaugeTypes,
+ nonConformanceRequiredActions,
+ nonConformanceTypes,
+ paymentTerms,
+ postingGroupInventory,
+ postingGroupPurchasing,
+ postingGroupSales,
+ scrapReasons,
+ sequences,
+ unitOfMeasures,
+ supplierStatuses as supplierStauses,
+} from "../../../src/seed/seed.data.ts";
+
+import { groups as _groups } from "../../../src/seed/seed.data.ts";
+
+export const groupCompanyTemplate = "XXXX-XXXX-XXXXXXXXXXXX";
+
+export const groups = _groups.map(({ idPrefix, ...g }) => ({
+ ...g,
+ id: `${idPrefix}-${groupCompanyTemplate}`,
+}));
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 107a2600e6..2f82a5f073 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -48680,14 +48680,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/seed-company/index.ts b/packages/database/supabase/functions/seed-company/index.ts
index 0db3168837..ed145340c8 100644
--- a/packages/database/supabase/functions/seed-company/index.ts
+++ b/packages/database/supabase/functions/seed-company/index.ts
@@ -64,7 +64,6 @@ serve(async (req: Request) => {
await db.transaction().execute(async (trx) => {
await trx
.withSchema("storage")
- // @ts-expect-error - it's legit, chill typescript
.insertInto("buckets")
.values({
id: companyId,