mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-28 06:28:47 +00:00
Remove deprecated SQL migration file and add new migration for default member organization flag. Update journal and snapshot metadata accordingly.
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
ALTER TABLE "application" ADD COLUMN "stopGracePeriodSwarm" bigint;--> statement-breakpoint
|
|
||||||
ALTER TABLE "mariadb" ADD COLUMN "stopGracePeriodSwarm" bigint;--> statement-breakpoint
|
|
||||||
ALTER TABLE "mongo" ADD COLUMN "stopGracePeriodSwarm" bigint;--> statement-breakpoint
|
|
||||||
ALTER TABLE "mysql" ADD COLUMN "stopGracePeriodSwarm" bigint;--> statement-breakpoint
|
|
||||||
ALTER TABLE "postgres" ADD COLUMN "stopGracePeriodSwarm" bigint;--> statement-breakpoint
|
|
||||||
ALTER TABLE "redis" ADD COLUMN "stopGracePeriodSwarm" bigint;
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "member" ADD COLUMN "is_default" boolean DEFAULT false NOT NULL;
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -800,13 +800,6 @@
|
|||||||
"tag": "0113_complete_rafael_vega",
|
"tag": "0113_complete_rafael_vega",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"idx": 114,
|
|
||||||
"version": "7",
|
|
||||||
"when": 1759643172958,
|
|
||||||
"tag": "0114_dry_black_tom",
|
|
||||||
"breakpoints": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"idx": 115,
|
"idx": 115,
|
||||||
"version": "7",
|
"version": "7",
|
||||||
@@ -841,6 +834,13 @@
|
|||||||
"when": 1761920677980,
|
"when": 1761920677980,
|
||||||
"tag": "0114_sudden_sheva_callister",
|
"tag": "0114_sudden_sheva_callister",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 120,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1762142154747,
|
||||||
|
"tag": "0120_plain_eternity",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -175,28 +175,19 @@ const { handler, api } = betterAuth({
|
|||||||
session: {
|
session: {
|
||||||
create: {
|
create: {
|
||||||
before: async (session) => {
|
before: async (session) => {
|
||||||
// First try to find the default organization for this user
|
// Find the default organization for this user
|
||||||
let member = await db.query.member.findFirst({
|
// Priority: 1) isDefault=true, 2) most recently created
|
||||||
where: and(
|
const member = await db.query.member.findFirst({
|
||||||
eq(schema.member.userId, session.userId),
|
where: eq(schema.member.userId, session.userId),
|
||||||
eq(schema.member.isDefault, true),
|
orderBy: [
|
||||||
),
|
desc(schema.member.isDefault),
|
||||||
|
desc(schema.member.createdAt),
|
||||||
|
],
|
||||||
with: {
|
with: {
|
||||||
organization: true,
|
organization: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// If no default is set, fallback to the most recently created organization
|
|
||||||
if (!member) {
|
|
||||||
member = await db.query.member.findFirst({
|
|
||||||
where: eq(schema.member.userId, session.userId),
|
|
||||||
orderBy: desc(schema.member.createdAt),
|
|
||||||
with: {
|
|
||||||
organization: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
...session,
|
...session,
|
||||||
|
|||||||
Reference in New Issue
Block a user