-
Notifications
You must be signed in to change notification settings - Fork 0
feat: initialize tables + index #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+43
−0
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
backend/supabase/migrations/20260114055101_users_table.sql
This file contains hidden or 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,16 @@ | ||
| -- Create users table | ||
| create table if not exists public.users ( | ||
| id uuid primary key default gen_random_uuid(), | ||
| first_name text not null, | ||
| last_name text not null, | ||
| employee_id text unique, | ||
| profile_picture text, | ||
| role text not null, | ||
| department text, | ||
| timezone text default 'UTC', | ||
| created_at timestamptz default now(), | ||
| updated_at timestamptz default now() | ||
| ); | ||
|
|
||
| -- Enable RLS | ||
| alter table public.users enable row level security; |
2 changes: 2 additions & 0 deletions
2
backend/supabase/migrations/20260114055356_users_employee_index.sql
This file contains hidden or 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 @@ | ||
| -- Create index on users table for employee_id | ||
| create index if not exists idx_users_employee_id on public.users(employee_id); | ||
25 changes: 25 additions & 0 deletions
25
backend/supabase/migrations/20260114055934_create_requests_table.sql
This file contains hidden or 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,25 @@ | ||
| -- Create requests table | ||
| create table if not exists public.requests ( | ||
| id uuid primary key default gen_random_uuid(), | ||
| hotel_id uuid not null references public.hotels(id) on delete cascade, | ||
| guest_id uuid, | ||
| user_id uuid references public.users(id) on delete set null, | ||
| reservation_id text, | ||
| name text not null, | ||
| description text, | ||
| room_id text, | ||
| request_category text, | ||
| request_type text not null, | ||
| department text, | ||
| status text not null, | ||
| priority text not null, | ||
| estimated_completion_time integer, -- in minutes | ||
| scheduled_time timestamptz, | ||
| completed_at timestamptz, | ||
| notes text not null, | ||
| created_at timestamptz default now(), | ||
| updated_at timestamptz default now() | ||
| ); | ||
|
|
||
| -- Enable RLS | ||
| alter table public.requests enable row level security; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only index I see needed atm