mirror of https://github.com/wg-easy/wg-easy
Browse Source
SQLite table-rebuild (drizzle 12-step pattern) making users_table.password nullable and adding auth_provider (default 'local'). Existing users backfill to 'local'. Registered in meta/_journal.json. Authored By: Culpur Defense Inc.pull/2693/head
2 changed files with 28 additions and 0 deletions
@ -0,0 +1,21 @@ |
|||
PRAGMA foreign_keys=OFF;--> statement-breakpoint |
|||
CREATE TABLE `__new_users_table` ( |
|||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, |
|||
`username` text NOT NULL, |
|||
`password` text, |
|||
`auth_provider` text DEFAULT 'local' NOT NULL, |
|||
`email` text, |
|||
`name` text NOT NULL, |
|||
`role` integer NOT NULL, |
|||
`totp_key` text, |
|||
`totp_verified` integer NOT NULL, |
|||
`enabled` integer NOT NULL, |
|||
`created_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL, |
|||
`updated_at` text DEFAULT (CURRENT_TIMESTAMP) NOT NULL |
|||
); |
|||
--> statement-breakpoint |
|||
INSERT INTO `__new_users_table`("id", "username", "password", "auth_provider", "email", "name", "role", "totp_key", "totp_verified", "enabled", "created_at", "updated_at") SELECT "id", "username", "password", 'local', "email", "name", "role", "totp_key", "totp_verified", "enabled", "created_at", "updated_at" FROM `users_table`;--> statement-breakpoint |
|||
DROP TABLE `users_table`;--> statement-breakpoint |
|||
ALTER TABLE `__new_users_table` RENAME TO `users_table`;--> statement-breakpoint |
|||
PRAGMA foreign_keys=ON;--> statement-breakpoint |
|||
CREATE UNIQUE INDEX `users_table_username_unique` ON `users_table` (`username`); |
|||
Loading…
Reference in new issue