feat(db): add invite_links + invite_redemptions tables + federatedRegistrationOpen
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
CREATE TABLE `invite_links` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`token` text NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`created_by` text NOT NULL,
|
||||
`created_at` integer NOT NULL,
|
||||
`max_uses` integer,
|
||||
`used_count` integer DEFAULT 0 NOT NULL,
|
||||
`expires_at` integer,
|
||||
`revoked_at` integer,
|
||||
FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `invite_redemptions` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`invite_id` text NOT NULL,
|
||||
`user_id` text,
|
||||
`registrant_username` text NOT NULL,
|
||||
`redeemed_at` integer NOT NULL,
|
||||
FOREIGN KEY (`invite_id`) REFERENCES `invite_links`(`id`) ON UPDATE no action ON DELETE cascade,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE `instance_settings` ADD `federated_registration_open` integer DEFAULT 1 NOT NULL;--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `invite_links_token_unique` ON `invite_links` (`token`);--> statement-breakpoint
|
||||
CREATE INDEX `idx_invite_links_created_at` ON `invite_links` (`created_at`);--> statement-breakpoint
|
||||
CREATE INDEX `idx_invite_redemptions_invite_id` ON `invite_redemptions` (`invite_id`);--> statement-breakpoint
|
||||
CREATE INDEX `idx_invite_redemptions_user_id` ON `invite_redemptions` (`user_id`);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,13 @@
|
||||
"when": 1777229997210,
|
||||
"tag": "0003_brave_inhumans",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 4,
|
||||
"version": "6",
|
||||
"when": 1777395066272,
|
||||
"tag": "0004_slim_mentallo",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user