feat:switch back to lemonsqueezy
This commit is contained in:
15
packages/db/src/migrations/0007_lemonsqueezy_migration.sql
Normal file
15
packages/db/src/migrations/0007_lemonsqueezy_migration.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
-- Migrate from Mollie back to LemonSqueezy
|
||||
-- Renames payment provider columns in registration and drinkkaart_topup tables,
|
||||
-- and restores the lemonsqueezy_customer_id column on registration.
|
||||
|
||||
-- registration table:
|
||||
-- mollie_payment_id -> lemonsqueezy_order_id
|
||||
-- (re-add) lemonsqueezy_customer_id
|
||||
|
||||
ALTER TABLE registration RENAME COLUMN mollie_payment_id TO lemonsqueezy_order_id;
|
||||
ALTER TABLE registration ADD COLUMN lemonsqueezy_customer_id text;
|
||||
|
||||
-- drinkkaart_topup table:
|
||||
-- mollie_payment_id -> lemonsqueezy_order_id
|
||||
|
||||
ALTER TABLE drinkkaart_topup RENAME COLUMN mollie_payment_id TO lemonsqueezy_order_id;
|
||||
@@ -46,7 +46,7 @@ export const drinkkaartTopup = sqliteTable("drinkkaart_topup", {
|
||||
balanceBefore: integer("balance_before").notNull(),
|
||||
balanceAfter: integer("balance_after").notNull(),
|
||||
type: text("type", { enum: ["payment", "admin_credit"] }).notNull(),
|
||||
molliePaymentId: text("mollie_payment_id").unique(), // nullable; only for type="payment"
|
||||
lemonsqueezyOrderId: text("lemonsqueezy_order_id").unique(), // nullable; only for type="payment"
|
||||
adminId: text("admin_id"), // nullable; only for type="admin_credit"
|
||||
reason: text("reason"),
|
||||
paidAt: integer("paid_at", { mode: "timestamp_ms" }).notNull(),
|
||||
|
||||
@@ -29,7 +29,8 @@ export const registration = sqliteTable(
|
||||
paymentStatus: text("payment_status").notNull().default("pending"),
|
||||
paymentAmount: integer("payment_amount").default(0),
|
||||
giftAmount: integer("gift_amount").default(0),
|
||||
molliePaymentId: text("mollie_payment_id"),
|
||||
lemonsqueezyOrderId: text("lemonsqueezy_order_id"),
|
||||
lemonsqueezyCustomerId: text("lemonsqueezy_customer_id"),
|
||||
paidAt: integer("paid_at", { mode: "timestamp_ms" }),
|
||||
// Set when the drinkCardValue has been credited to the user's drinkkaart.
|
||||
// Null means not yet credited (either unpaid, account doesn't exist yet, or
|
||||
@@ -49,6 +50,6 @@ export const registration = sqliteTable(
|
||||
index("registration_managementToken_idx").on(table.managementToken),
|
||||
index("registration_paymentStatus_idx").on(table.paymentStatus),
|
||||
index("registration_giftAmount_idx").on(table.giftAmount),
|
||||
index("registration_molliePaymentId_idx").on(table.molliePaymentId),
|
||||
index("registration_lemonsqueezyOrderId_idx").on(table.lemonsqueezyOrderId),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user