Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-07 18:09:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-07 18:09:14 +0300
commit9498dc957345829f29fe0bc4e55c969783b457be (patch)
treeca19b899f1eee13ad892fe18ece040347c3a1e71 /db
parentba27dbddc7dbc42f2cc8d84e815a9ea19f87a81d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/docs/subscription_add_on_purchases.yml10
-rw-r--r--db/docs/subscription_add_ons.yml10
-rw-r--r--db/migrate/20230531134916_create_subscription_add_ons.rb12
-rw-r--r--db/migrate/20230531135001_create_subscription_add_on_purchases.rb18
-rw-r--r--db/migrate/20230531142032_add_foreign_key_subscription_add_on_id_on_subscription_add_on_purchases.rb18
-rw-r--r--db/migrate/20230531142053_add_foreign_key_namespace_id_on_subscription_add_on_purchases.rb15
-rw-r--r--db/schema_migrations/202305311349161
-rw-r--r--db/schema_migrations/202305311350011
-rw-r--r--db/schema_migrations/202305311420321
-rw-r--r--db/schema_migrations/202305311420531
-rw-r--r--db/structure.sql61
11 files changed, 148 insertions, 0 deletions
diff --git a/db/docs/subscription_add_on_purchases.yml b/db/docs/subscription_add_on_purchases.yml
new file mode 100644
index 00000000000..21915cff545
--- /dev/null
+++ b/db/docs/subscription_add_on_purchases.yml
@@ -0,0 +1,10 @@
+---
+table_name: subscription_add_on_purchases
+description: Stores add-on purchase information
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122662
+milestone: '16.1'
+feature_categories:
+- subscription_management
+classes:
+- GitlabSubscriptions::AddOnPurchase
+gitlab_schema: gitlab_main
diff --git a/db/docs/subscription_add_ons.yml b/db/docs/subscription_add_ons.yml
new file mode 100644
index 00000000000..93730f80a99
--- /dev/null
+++ b/db/docs/subscription_add_ons.yml
@@ -0,0 +1,10 @@
+---
+table_name: subscription_add_ons
+description: Stores available add-ons for which purchases are stored in `subscription_add_on_purchases`.
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122662
+milestone: '16.1'
+feature_categories:
+- subscription_management
+classes:
+- GitlabSubscriptions::AddOn
+gitlab_schema: gitlab_main
diff --git a/db/migrate/20230531134916_create_subscription_add_ons.rb b/db/migrate/20230531134916_create_subscription_add_ons.rb
new file mode 100644
index 00000000000..5faee049534
--- /dev/null
+++ b/db/migrate/20230531134916_create_subscription_add_ons.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class CreateSubscriptionAddOns < Gitlab::Database::Migration[2.1]
+ def change
+ create_table :subscription_add_ons, if_not_exists: true do |t|
+ t.timestamps_with_timezone null: false
+
+ t.integer :name, limit: 2, null: false, index: { unique: true }
+ t.text :description, null: false, limit: 512
+ end
+ end
+end
diff --git a/db/migrate/20230531135001_create_subscription_add_on_purchases.rb b/db/migrate/20230531135001_create_subscription_add_on_purchases.rb
new file mode 100644
index 00000000000..6fdf1fdd495
--- /dev/null
+++ b/db/migrate/20230531135001_create_subscription_add_on_purchases.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateSubscriptionAddOnPurchases < Gitlab::Database::Migration[2.1]
+ def change
+ create_table :subscription_add_on_purchases, if_not_exists: true do |t|
+ t.timestamps_with_timezone null: false
+
+ t.bigint :subscription_add_on_id, null: false
+ t.bigint :namespace_id, null: false
+ t.integer :quantity, null: false
+ t.date :expires_on, null: false
+ t.text :purchase_xid, null: false, limit: 255
+
+ t.index :subscription_add_on_id
+ t.index :namespace_id
+ end
+ end
+end
diff --git a/db/migrate/20230531142032_add_foreign_key_subscription_add_on_id_on_subscription_add_on_purchases.rb b/db/migrate/20230531142032_add_foreign_key_subscription_add_on_id_on_subscription_add_on_purchases.rb
new file mode 100644
index 00000000000..234cd2fa3af
--- /dev/null
+++ b/db/migrate/20230531142032_add_foreign_key_subscription_add_on_id_on_subscription_add_on_purchases.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddForeignKeySubscriptionAddOnIdOnSubscriptionAddOnPurchases < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :subscription_add_on_purchases,
+ :subscription_add_ons,
+ column: :subscription_add_on_id,
+ on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :subscription_add_on_purchases, column: :subscription_add_on_id
+ end
+ end
+end
diff --git a/db/migrate/20230531142053_add_foreign_key_namespace_id_on_subscription_add_on_purchases.rb b/db/migrate/20230531142053_add_foreign_key_namespace_id_on_subscription_add_on_purchases.rb
new file mode 100644
index 00000000000..7f7083a3a9c
--- /dev/null
+++ b/db/migrate/20230531142053_add_foreign_key_namespace_id_on_subscription_add_on_purchases.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddForeignKeyNamespaceIdOnSubscriptionAddOnPurchases < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :subscription_add_on_purchases, :namespaces, column: :namespace_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :subscription_add_on_purchases, column: :namespace_id
+ end
+ end
+end
diff --git a/db/schema_migrations/20230531134916 b/db/schema_migrations/20230531134916
new file mode 100644
index 00000000000..5cf00727101
--- /dev/null
+++ b/db/schema_migrations/20230531134916
@@ -0,0 +1 @@
+fc2e3d8e6aca7b00569340b0468488a4b0545b39e67857a5b40824f6d0a62a97 \ No newline at end of file
diff --git a/db/schema_migrations/20230531135001 b/db/schema_migrations/20230531135001
new file mode 100644
index 00000000000..32850b297da
--- /dev/null
+++ b/db/schema_migrations/20230531135001
@@ -0,0 +1 @@
+1a672c9412b8ceeec35fd375bf86dde325781c9cb94340995d2cab4bb804e4bf \ No newline at end of file
diff --git a/db/schema_migrations/20230531142032 b/db/schema_migrations/20230531142032
new file mode 100644
index 00000000000..bae2817773a
--- /dev/null
+++ b/db/schema_migrations/20230531142032
@@ -0,0 +1 @@
+3e77f991a4daa9756b541255e3b8da9d8accb52a5a4b625613771982e3dff3b5 \ No newline at end of file
diff --git a/db/schema_migrations/20230531142053 b/db/schema_migrations/20230531142053
new file mode 100644
index 00000000000..55da4601012
--- /dev/null
+++ b/db/schema_migrations/20230531142053
@@ -0,0 +1 @@
+0a4b3b8848f486e34e1f0426bae4e15f67e851447fc3fe397cf2039e03b185b5 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index cc22a017044..23e2df53c91 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -23031,6 +23031,45 @@ CREATE SEQUENCE status_page_settings_project_id_seq
ALTER SEQUENCE status_page_settings_project_id_seq OWNED BY status_page_settings.project_id;
+CREATE TABLE subscription_add_on_purchases (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ subscription_add_on_id bigint NOT NULL,
+ namespace_id bigint NOT NULL,
+ quantity integer NOT NULL,
+ expires_on date NOT NULL,
+ purchase_xid text NOT NULL,
+ CONSTRAINT check_3313c4d200 CHECK ((char_length(purchase_xid) <= 255))
+);
+
+CREATE SEQUENCE subscription_add_on_purchases_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE subscription_add_on_purchases_id_seq OWNED BY subscription_add_on_purchases.id;
+
+CREATE TABLE subscription_add_ons (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ name smallint NOT NULL,
+ description text NOT NULL,
+ CONSTRAINT check_4c39d15ada CHECK ((char_length(description) <= 512))
+);
+
+CREATE SEQUENCE subscription_add_ons_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE subscription_add_ons_id_seq OWNED BY subscription_add_ons.id;
+
CREATE TABLE subscriptions (
id integer NOT NULL,
user_id integer,
@@ -25847,6 +25886,10 @@ ALTER TABLE ONLY status_page_published_incidents ALTER COLUMN id SET DEFAULT nex
ALTER TABLE ONLY status_page_settings ALTER COLUMN project_id SET DEFAULT nextval('status_page_settings_project_id_seq'::regclass);
+ALTER TABLE ONLY subscription_add_on_purchases ALTER COLUMN id SET DEFAULT nextval('subscription_add_on_purchases_id_seq'::regclass);
+
+ALTER TABLE ONLY subscription_add_ons ALTER COLUMN id SET DEFAULT nextval('subscription_add_ons_id_seq'::regclass);
+
ALTER TABLE ONLY subscriptions ALTER COLUMN id SET DEFAULT nextval('subscriptions_id_seq'::regclass);
ALTER TABLE ONLY suggestions ALTER COLUMN id SET DEFAULT nextval('suggestions_id_seq'::regclass);
@@ -28317,6 +28360,12 @@ ALTER TABLE ONLY status_page_published_incidents
ALTER TABLE ONLY status_page_settings
ADD CONSTRAINT status_page_settings_pkey PRIMARY KEY (project_id);
+ALTER TABLE ONLY subscription_add_on_purchases
+ ADD CONSTRAINT subscription_add_on_purchases_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY subscription_add_ons
+ ADD CONSTRAINT subscription_add_ons_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY subscriptions
ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id);
@@ -32871,6 +32920,12 @@ CREATE UNIQUE INDEX index_status_page_published_incidents_on_issue_id ON status_
CREATE INDEX index_status_page_settings_on_project_id ON status_page_settings USING btree (project_id);
+CREATE INDEX index_subscription_add_on_purchases_on_namespace_id ON subscription_add_on_purchases USING btree (namespace_id);
+
+CREATE INDEX index_subscription_add_on_purchases_on_subscription_add_on_id ON subscription_add_on_purchases USING btree (subscription_add_on_id);
+
+CREATE UNIQUE INDEX index_subscription_add_ons_on_name ON subscription_add_ons USING btree (name);
+
CREATE INDEX index_subscriptions_on_project_id ON subscriptions USING btree (project_id);
CREATE UNIQUE INDEX index_subscriptions_on_subscribable_and_user_id_and_project_id ON subscriptions USING btree (subscribable_id, subscribable_type, user_id, project_id);
@@ -35420,6 +35475,9 @@ ALTER TABLE ONLY abuse_reports
ALTER TABLE ONLY protected_environment_approval_rules
ADD CONSTRAINT fk_405568b491 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY subscription_add_on_purchases
+ ADD CONSTRAINT fk_410004d68b FOREIGN KEY (subscription_add_on_id) REFERENCES subscription_add_ons(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_pipeline_schedule_variables
ADD CONSTRAINT fk_41c35fda51 FOREIGN KEY (pipeline_schedule_id) REFERENCES ci_pipeline_schedules(id) ON DELETE CASCADE;
@@ -35768,6 +35826,9 @@ ALTER TABLE ONLY issues
ALTER TABLE ONLY ml_candidates
ADD CONSTRAINT fk_a1d5f1bc45 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE SET NULL;
+ALTER TABLE ONLY subscription_add_on_purchases
+ ADD CONSTRAINT fk_a1db288990 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE p_ci_builds
ADD CONSTRAINT fk_a2141b1522 FOREIGN KEY (auto_canceled_by_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL;