-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: save connection on the cloud with encryption (#27)
* rework local connection manager * feat: add edit connection local storage * fixing the server-side error * feat: add remove connection * add key generation * add migration * feat: add query * feat: add proxy query * remove all console.log * feat: delete and update database * update remote connection * feat: add remove connection * add remote connection * finish the header
- Loading branch information
Showing
49 changed files
with
4,012 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
CREATE TABLE `database` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`user_id` text NOT NULL, | ||
`name` text, | ||
`description` text, | ||
`color` text DEFAULT 'gray', | ||
`driver` text DEFAULT 'turso', | ||
`host` text, | ||
`token` text, | ||
`created_at` integer, | ||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `database_role` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`database_id` text NOT NULL, | ||
`name` text, | ||
`can_execute_query` integer DEFAULT 0, | ||
`created_by` text, | ||
`created_at` integer, | ||
`updated_by` text, | ||
`updated_at` integer, | ||
FOREIGN KEY (`database_id`) REFERENCES `database`(`id`) ON UPDATE no action ON DELETE no action, | ||
FOREIGN KEY (`created_by`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action, | ||
FOREIGN KEY (`updated_by`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `database_role_permission` ( | ||
`id` text PRIMARY KEY NOT NULL, | ||
`role_id` text NOT NULL, | ||
`role` text, | ||
`access` text, | ||
`table_name` text, | ||
`column_name` text, | ||
`created_by` text, | ||
`created_at` integer, | ||
`updated_by` text, | ||
`updated_at` integer, | ||
FOREIGN KEY (`role_id`) REFERENCES `database_role`(`id`) ON UPDATE no action ON DELETE no action, | ||
FOREIGN KEY (`created_by`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action, | ||
FOREIGN KEY (`updated_by`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE `database_user_role` ( | ||
`user_id` text, | ||
`database_id` text, | ||
`role_id` text, | ||
`created_at` integer, | ||
PRIMARY KEY(`database_id`, `user_id`), | ||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action, | ||
FOREIGN KEY (`database_id`) REFERENCES `database`(`id`) ON UPDATE no action ON DELETE no action, | ||
FOREIGN KEY (`role_id`) REFERENCES `database_role`(`id`) ON UPDATE no action ON DELETE no action | ||
); | ||
--> statement-breakpoint | ||
CREATE INDEX `database_user_idx` ON `database` (`user_id`);--> statement-breakpoint | ||
CREATE INDEX `database_role_idx` ON `database_role` (`database_id`);--> statement-breakpoint | ||
CREATE INDEX `role_permission_table_idx` ON `database_role_permission` (`role_id`,`table_name`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE database_role ADD `is_owner` integer DEFAULT 0;--> statement-breakpoint | ||
ALTER TABLE database_user_role ADD `created_by` text REFERENCES user(id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE database ADD `deleted_at` integer; |
Oops, something went wrong.