diff --git a/app/models/access_token.rb b/app/models/access_token.rb index b4168b28..f8c4707d 100644 --- a/app/models/access_token.rb +++ b/app/models/access_token.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class AccessToken < ApplicationRecord - include Uuidable - FORMAT_BY_PROVIDER = { Providerable::GITHUB => 'github_pat_', Providerable::GITLAB => 'glpat-' diff --git a/app/models/api_access_token.rb b/app/models/api_access_token.rb index 2185710e..92a5bf8c 100644 --- a/app/models/api_access_token.rb +++ b/app/models/api_access_token.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class ApiAccessToken < ApplicationRecord - include Uuidable - encrypts :value, deterministic: true belongs_to :user diff --git a/app/models/companies/user.rb b/app/models/companies/user.rb index d4bd6e6d..41d88d69 100644 --- a/app/models/companies/user.rb +++ b/app/models/companies/user.rb @@ -4,8 +4,6 @@ module Companies class User < ApplicationRecord self.table_name = :companies_users - include Uuidable - READ = 'read' WRITE = 'write' diff --git a/app/models/company.rb b/app/models/company.rb index e35d42bd..d06b35de 100644 --- a/app/models/company.rb +++ b/app/models/company.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true class Company < ApplicationRecord - include Uuidable include Tokenable include Insightable include Configurable diff --git a/app/models/concerns/uuidable.rb b/app/models/concerns/uuidable.rb deleted file mode 100644 index 5d2df676..00000000 --- a/app/models/concerns/uuidable.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module Uuidable - extend ActiveSupport::Concern - - included do - after_initialize :generate_uuid - end - - def generate_uuid - self.uuid ||= SecureRandom.uuid - end -end diff --git a/app/models/entity.rb b/app/models/entity.rb index 31099c74..98a23b20 100644 --- a/app/models/entity.rb +++ b/app/models/entity.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true class Entity < ApplicationRecord - include Uuidable include Providerable EMPTY_PAYLOAD = { diff --git a/app/models/entity/ignore.rb b/app/models/entity/ignore.rb index ca484d94..ae650844 100644 --- a/app/models/entity/ignore.rb +++ b/app/models/entity/ignore.rb @@ -4,8 +4,6 @@ class Entity class Ignore < ApplicationRecord self.table_name = :ignores - include Uuidable - belongs_to :insightable, polymorphic: true end end diff --git a/app/models/excludes/group.rb b/app/models/excludes/group.rb index a544bfc7..9f27277f 100644 --- a/app/models/excludes/group.rb +++ b/app/models/excludes/group.rb @@ -4,8 +4,6 @@ module Excludes class Group < ApplicationRecord self.table_name = :excludes_groups - include Uuidable - FREE_GROUPS_AMOUNT = 2 belongs_to :insightable, polymorphic: true diff --git a/app/models/excludes/rule.rb b/app/models/excludes/rule.rb index 3c19cc09..ff5fc5f8 100644 --- a/app/models/excludes/rule.rb +++ b/app/models/excludes/rule.rb @@ -4,8 +4,6 @@ module Excludes class Rule < ApplicationRecord self.table_name = :excludes_rules - include Uuidable - FREE_RULES_AMOUNT = 3 TITLE_TARGET = 'title' diff --git a/app/models/invite.rb b/app/models/invite.rb index 44b06e48..0cf4f283 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class Invite < ApplicationRecord - include Uuidable - INVITEABLE_TYPES = %w[ User Company diff --git a/app/models/issue.rb b/app/models/issue.rb index 7928af48..3b8fc49b 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class Issue < ApplicationRecord - include Uuidable - belongs_to :repository has_many :comments, class_name: 'Issue::Comment', dependent: :destroy diff --git a/app/models/issue/comment.rb b/app/models/issue/comment.rb index 6d9fc31d..a9e2e8de 100644 --- a/app/models/issue/comment.rb +++ b/app/models/issue/comment.rb @@ -2,8 +2,6 @@ class Issue class Comment < ApplicationRecord - include Uuidable - belongs_to :issue end end diff --git a/app/models/kudos/achievement.rb b/app/models/kudos/achievement.rb index e341a231..851fc8c6 100644 --- a/app/models/kudos/achievement.rb +++ b/app/models/kudos/achievement.rb @@ -5,7 +5,6 @@ class Achievement < Kudos::ApplicationRecord self.table_name = :kudos_achievements include Kudos - include Uuidable belongs_to :kudos_achievement_group, class_name: 'Kudos::AchievementGroup' diff --git a/app/models/kudos/achievement_group.rb b/app/models/kudos/achievement_group.rb index 6cfca3a8..dd4ec2a1 100644 --- a/app/models/kudos/achievement_group.rb +++ b/app/models/kudos/achievement_group.rb @@ -4,8 +4,6 @@ module Kudos class AchievementGroup < ApplicationRecord self.table_name = :kudos_achievement_groups - include Uuidable - belongs_to :parent, class_name: 'Kudos::AchievementGroup', foreign_key: :parent_id, diff --git a/app/models/notification.rb b/app/models/notification.rb index dd3c5669..2f778293 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class Notification < ApplicationRecord - include Uuidable - NOTIFYABLE_TYPES = %w[ Company Repository diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index 0f397242..45233318 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class PullRequest < ApplicationRecord - include Uuidable - belongs_to :repository belongs_to :entity diff --git a/app/models/repository.rb b/app/models/repository.rb index 7feb0744..62dbe3e8 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true class Repository < ApplicationRecord - include Uuidable include Tokenable include Insightable include Providerable diff --git a/app/models/user.rb b/app/models/user.rb index ec95e532..f4ae471f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true class User < ApplicationRecord - include Uuidable include Kudos::Achievementable include Notifyable include Inviteable diff --git a/app/models/user/session.rb b/app/models/user/session.rb index 2c381c5d..34b525cb 100644 --- a/app/models/user/session.rb +++ b/app/models/user/session.rb @@ -4,8 +4,6 @@ class User class Session < ApplicationRecord self.table_name = :users_sessions - include Uuidable - belongs_to :user end end diff --git a/app/models/webhook.rb b/app/models/webhook.rb index a8adb41d..4f31a529 100644 --- a/app/models/webhook.rb +++ b/app/models/webhook.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class Webhook < ApplicationRecord - include Uuidable - CUSTOM = 'custom' SLACK = 'slack' DISCORD = 'discord' diff --git a/db/migrate/20241207103004_add_uuids_to_tables.rb b/db/migrate/20241207103004_add_uuids_to_tables.rb new file mode 100644 index 00000000..76b9da21 --- /dev/null +++ b/db/migrate/20241207103004_add_uuids_to_tables.rb @@ -0,0 +1,38 @@ +class AddUuidsToTables < ActiveRecord::Migration[7.2] + disable_ddl_transaction! + + TABLES_WITH_MODELS = { + work_times: WorkTime, + vacations: User::Vacation, + subscriptions: User::Subscription, + subscribers: Subscriber, + repositories_insights: Repositories::Insight, + pull_requests_reviews: PullRequest::Review, + pull_requests_comments: PullRequest::Comment, + insights: Insight, + identities: Identity, + feedbacks: User::Feedback + } + + def up + TABLES_WITH_MODELS.each do |table, model| + add_column table, :uuid, :uuid + change_column_default table, :uuid, 'gen_random_uuid()' + add_index table, :uuid, unique: true, algorithm: :concurrently + + model.unscoped.in_batches do |relation| + relation.where(uuid: nil).update_all('uuid = gen_random_uuid()') + end + + safety_assured { change_column_null table, :uuid, false } + end + end + + def down + safety_assured do + TABLES_WITH_MODELS.each_key do |table| + remove_column table, :uuid + end + end + end +end diff --git a/db/migrate/20241207105035_change_uuid_defaults.rb b/db/migrate/20241207105035_change_uuid_defaults.rb new file mode 100644 index 00000000..75204943 --- /dev/null +++ b/db/migrate/20241207105035_change_uuid_defaults.rb @@ -0,0 +1,15 @@ +class ChangeUuidDefaults < ActiveRecord::Migration[7.2] + TABLES = %i[ + webhooks users_sessions users repositories pull_requests + notifications issues issue_comments invites ignores excludes_rules + excludes_groups entities companies_users companies api_access_tokens access_tokens + ] + + def change + safety_assured do + TABLES.each do |table| + change_column_default table, :uuid, 'gen_random_uuid()' + end + end + end +end diff --git a/db/migrate/20241207105036_change_uuid_defaults_kudos.rb b/db/migrate/20241207105036_change_uuid_defaults_kudos.rb new file mode 100644 index 00000000..dc3271de --- /dev/null +++ b/db/migrate/20241207105036_change_uuid_defaults_kudos.rb @@ -0,0 +1,13 @@ +class ChangeUuidDefaultsKudos < ActiveRecord::Migration[7.2] + TABLES = %i[ + kudos_achievements kudos_achievement_groups + ] + + def change + safety_assured do + TABLES.each do |table| + change_column_default table, :uuid, 'gen_random_uuid()' + end + end + end +end diff --git a/db/structure.sql b/db/structure.sql index 7d7dd8d8..ed1eaf45 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1,6 +1,7 @@ SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; +SET transaction_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); @@ -254,7 +255,7 @@ $$; CREATE TABLE public.access_tokens ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, tokenable_id bigint NOT NULL, tokenable_type character varying NOT NULL, value text NOT NULL, @@ -293,7 +294,7 @@ CREATE TABLE public.api_access_tokens ( value text NOT NULL, created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL, - uuid uuid NOT NULL + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -334,7 +335,7 @@ CREATE TABLE public.ar_internal_metadata ( CREATE TABLE public.companies ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, user_id bigint NOT NULL, title character varying NOT NULL, created_at timestamp(6) without time zone NOT NULL, @@ -372,7 +373,7 @@ ALTER SEQUENCE public.companies_id_seq OWNED BY public.companies.id; CREATE TABLE public.companies_users ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, company_id bigint NOT NULL, user_id bigint NOT NULL, invite_id bigint NOT NULL, @@ -445,7 +446,7 @@ ALTER SEQUENCE public.emailbutler_messages_id_seq OWNED BY public.emailbutler_me CREATE TABLE public.entities ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, external_id character varying NOT NULL, provider integer DEFAULT 0 NOT NULL, login character varying, @@ -548,7 +549,7 @@ ALTER SEQUENCE public.event_store_events_in_streams_id_seq OWNED BY public.event CREATE TABLE public.excludes_groups ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, insightable_id bigint NOT NULL, insightable_type character varying NOT NULL, created_at timestamp(6) without time zone NOT NULL, @@ -581,7 +582,7 @@ ALTER SEQUENCE public.excludes_groups_id_seq OWNED BY public.excludes_groups.id; CREATE TABLE public.excludes_rules ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, excludes_group_id bigint NOT NULL, target integer NOT NULL, condition integer NOT NULL, @@ -643,7 +644,8 @@ CREATE TABLE public.feedbacks ( created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL, email text, - answerable boolean DEFAULT false NOT NULL + answerable boolean DEFAULT false NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -678,7 +680,8 @@ CREATE TABLE public.identities ( email text, created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL, - login character varying + login character varying, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -707,7 +710,7 @@ ALTER SEQUENCE public.identities_id_seq OWNED BY public.identities.id; CREATE TABLE public.ignores ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, insightable_id bigint NOT NULL, insightable_type character varying NOT NULL, entity_value character varying NOT NULL, @@ -762,7 +765,8 @@ CREATE TABLE public.insights ( hidden boolean DEFAULT false NOT NULL, bad_reviews_count integer DEFAULT 0 NOT NULL, conventional_comments_count integer DEFAULT 0, - time_since_last_open_pull_seconds integer DEFAULT 0 + time_since_last_open_pull_seconds integer DEFAULT 0, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -805,7 +809,7 @@ ALTER SEQUENCE public.insights_id_seq OWNED BY public.insights.id; CREATE TABLE public.invites ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, inviteable_id bigint NOT NULL, inviteable_type character varying NOT NULL, receiver_id bigint, @@ -842,7 +846,7 @@ ALTER SEQUENCE public.invites_id_seq OWNED BY public.invites.id; CREATE TABLE public.issue_comments ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, issue_id bigint NOT NULL, external_id character varying NOT NULL, comment_created_at timestamp(6) without time zone, @@ -890,7 +894,7 @@ ALTER SEQUENCE public.issue_comments_id_seq OWNED BY public.issue_comments.id; CREATE TABLE public.issues ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, repository_id bigint NOT NULL, opened_at timestamp(6) without time zone, closed_at timestamp(6) without time zone, @@ -925,7 +929,7 @@ ALTER SEQUENCE public.issues_id_seq OWNED BY public.issues.id; CREATE TABLE public.kudos_achievement_groups ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, parent_id bigint, "position" integer DEFAULT 0 NOT NULL, name jsonb DEFAULT '{}'::jsonb NOT NULL, @@ -959,7 +963,7 @@ ALTER SEQUENCE public.kudos_achievement_groups_id_seq OWNED BY public.kudos_achi CREATE TABLE public.kudos_achievements ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, award_name character varying NOT NULL, rank integer, points integer, @@ -1038,7 +1042,7 @@ CREATE TABLE public.notifications ( notification_type integer NOT NULL, created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, webhook_id bigint NOT NULL ); @@ -1068,7 +1072,7 @@ ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id; CREATE TABLE public.pull_requests ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, repository_id bigint NOT NULL, created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL, @@ -1102,7 +1106,8 @@ CREATE TABLE public.pull_requests_comments ( updated_at timestamp(6) without time zone NOT NULL, pull_request_id bigint NOT NULL, entity_id bigint NOT NULL, - parsed_body jsonb + parsed_body jsonb, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -1158,7 +1163,8 @@ CREATE TABLE public.pull_requests_reviews ( entity_id bigint NOT NULL, required boolean DEFAULT false NOT NULL, state integer DEFAULT 0 NOT NULL, - commit_external_id character varying + commit_external_id character varying, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -1236,7 +1242,7 @@ WITH (fillfactor='90'); CREATE TABLE public.repositories ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, company_id bigint NOT NULL, title character varying NOT NULL, created_at timestamp(6) without time zone NOT NULL, @@ -1295,7 +1301,8 @@ CREATE TABLE public.repositories_insights ( open_issues_count integer DEFAULT 0 NOT NULL, closed_issues_count integer DEFAULT 0 NOT NULL, average_issue_comment_time integer DEFAULT 0 NOT NULL, - average_issue_close_time integer DEFAULT 0 NOT NULL + average_issue_close_time integer DEFAULT 0 NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -1365,7 +1372,8 @@ CREATE TABLE public.subscribers ( unsubscribe_token character varying, unsubscribed_at timestamp(6) without time zone, created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL + updated_at timestamp(6) without time zone NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -1399,7 +1407,8 @@ CREATE TABLE public.subscriptions ( end_time timestamp(6) without time zone NOT NULL, created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL, - external_invoice_id character varying + external_invoice_id character varying, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -1435,7 +1444,7 @@ ALTER SEQUENCE public.subscriptions_id_seq OWNED BY public.subscriptions.id; CREATE TABLE public.users ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, email text DEFAULT ''::character varying NOT NULL, created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL, @@ -1474,7 +1483,7 @@ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; CREATE TABLE public.users_sessions ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, user_id bigint NOT NULL, created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL @@ -1510,7 +1519,8 @@ CREATE TABLE public.vacations ( start_time timestamp(6) without time zone NOT NULL, end_time timestamp(6) without time zone NOT NULL, created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL + updated_at timestamp(6) without time zone NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -1539,7 +1549,7 @@ ALTER SEQUENCE public.vacations_id_seq OWNED BY public.vacations.id; CREATE TABLE public.webhooks ( id bigint NOT NULL, - uuid uuid NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL, source integer DEFAULT 0 NOT NULL, url character varying NOT NULL, created_at timestamp(6) without time zone NOT NULL, @@ -1579,7 +1589,8 @@ CREATE TABLE public.work_times ( ends_at character varying NOT NULL, timezone character varying DEFAULT '0'::character varying NOT NULL, created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL + updated_at timestamp(6) without time zone NOT NULL, + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -2340,6 +2351,13 @@ CREATE UNIQUE INDEX index_excludes_rules_on_uuid ON public.excludes_rules USING CREATE INDEX index_feedbacks_on_user_id ON public.feedbacks USING btree (user_id); +-- +-- Name: index_feedbacks_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_feedbacks_on_uuid ON public.feedbacks USING btree (uuid); + + -- -- Name: index_identities_on_uid_and_provider; Type: INDEX; Schema: public; Owner: - -- @@ -2354,6 +2372,13 @@ CREATE UNIQUE INDEX index_identities_on_uid_and_provider ON public.identities US CREATE INDEX index_identities_on_user_id ON public.identities USING btree (user_id); +-- +-- Name: index_identities_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_identities_on_uuid ON public.identities USING btree (uuid); + + -- -- Name: index_ignores_on_uuid; Type: INDEX; Schema: public; Owner: - -- @@ -2375,6 +2400,13 @@ CREATE INDEX index_insights_on_entity_id ON public.insights USING btree (entity_ CREATE INDEX index_insights_on_insightable_id_and_insightable_type ON public.insights USING btree (insightable_id, insightable_type); +-- +-- Name: index_insights_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_insights_on_uuid ON public.insights USING btree (uuid); + + -- -- Name: index_invites_on_uuid; Type: INDEX; Schema: public; Owner: - -- @@ -2480,6 +2512,13 @@ CREATE UNIQUE INDEX index_notifications_on_webhook_id_and_notification_type ON p CREATE INDEX index_pull_requests_comments_on_external_id ON public.pull_requests_comments USING btree (external_id); +-- +-- Name: index_pull_requests_comments_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_pull_requests_comments_on_uuid ON public.pull_requests_comments USING btree (uuid); + + -- -- Name: index_pull_requests_on_entity_id; Type: INDEX; Schema: public; Owner: - -- @@ -2508,6 +2547,13 @@ CREATE UNIQUE INDEX index_pull_requests_on_uuid ON public.pull_requests USING bt CREATE INDEX index_pull_requests_reviews_on_external_id ON public.pull_requests_reviews USING btree (external_id); +-- +-- Name: index_pull_requests_reviews_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_pull_requests_reviews_on_uuid ON public.pull_requests_reviews USING btree (uuid); + + -- -- Name: index_repositories_insights_on_repository_id; Type: INDEX; Schema: public; Owner: - -- @@ -2515,6 +2561,13 @@ CREATE INDEX index_pull_requests_reviews_on_external_id ON public.pull_requests_ CREATE INDEX index_repositories_insights_on_repository_id ON public.repositories_insights USING btree (repository_id); +-- +-- Name: index_repositories_insights_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_repositories_insights_on_uuid ON public.repositories_insights USING btree (uuid); + + -- -- Name: index_repositories_on_company_id; Type: INDEX; Schema: public; Owner: - -- @@ -2536,6 +2589,13 @@ CREATE UNIQUE INDEX index_repositories_on_uuid ON public.repositories USING btre CREATE UNIQUE INDEX index_subscribers_on_email ON public.subscribers USING btree (email); +-- +-- Name: index_subscribers_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_subscribers_on_uuid ON public.subscribers USING btree (uuid); + + -- -- Name: index_subscriptions_on_user_id; Type: INDEX; Schema: public; Owner: - -- @@ -2543,6 +2603,13 @@ CREATE UNIQUE INDEX index_subscribers_on_email ON public.subscribers USING btree CREATE INDEX index_subscriptions_on_user_id ON public.subscriptions USING btree (user_id); +-- +-- Name: index_subscriptions_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_subscriptions_on_uuid ON public.subscriptions USING btree (uuid); + + -- -- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: - -- @@ -2578,6 +2645,13 @@ CREATE UNIQUE INDEX index_users_sessions_on_uuid ON public.users_sessions USING CREATE INDEX index_vacations_on_user_id ON public.vacations USING btree (user_id); +-- +-- Name: index_vacations_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_vacations_on_uuid ON public.vacations USING btree (uuid); + + -- -- Name: index_webhooks_on_company_id_and_source_and_url; Type: INDEX; Schema: public; Owner: - -- @@ -2592,6 +2666,13 @@ CREATE UNIQUE INDEX index_webhooks_on_company_id_and_source_and_url ON public.we CREATE UNIQUE INDEX index_webhooks_on_uuid ON public.webhooks USING btree (uuid); +-- +-- Name: index_work_times_on_uuid; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_work_times_on_uuid ON public.work_times USING btree (uuid); + + -- -- Name: index_work_times_on_worktimeable_id_and_worktimeable_type; Type: INDEX; Schema: public; Owner: - -- @@ -2679,6 +2760,9 @@ ALTER TABLE ONLY public.kudos_achievements SET search_path TO "$user", public; INSERT INTO "schema_migrations" (version) VALUES +('20241207105036'), +('20241207105035'), +('20241207103004'), ('20241021055406'), ('20241018121510'), ('20241018094904'),