Skip to content

Commit

Permalink
chore: cleaned up sql file comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Dec 20, 2024
1 parent f0d6822 commit 9232343
Show file tree
Hide file tree
Showing 24 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion internal/db/testdata/invalidmigrations/001_initial.up.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_1.sql initialises an empty database.
-- initialises an empty database.

CREATE TABLE IF NOT EXISTS test (
id BIGSERIAL PRIMARY KEY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_2.sql is a migration that adds an invalid table.
-- adds an invalid table.

CREATE TABLE IF NOT EXISTS invalid (
id BIGSERIAL PRIMARY KEY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_3.sql is a migration that adds an controller table.
-- adds an controller table.

CREATE TABLE IF NOT EXISTS controller (
id BIGSERIAL PRIMARY KEY,
Expand Down
2 changes: 1 addition & 1 deletion internal/db/testdata/validmigrations/001_initial.up.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_1.sql initialises an empty database.
-- initialises an empty database.

CREATE TABLE IF NOT EXISTS test (
id BIGSERIAL PRIMARY KEY,
Expand Down
2 changes: 1 addition & 1 deletion internal/db/testdata/validmigrations/002_add_table.up.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_2.sql is a migration that adds a valid table.
-- adds a valid table.

CREATE TABLE IF NOT EXISTS valid (
id BIGSERIAL PRIMARY KEY
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_3.sql is a migration that adds an controller table.
-- adds a controller table.

CREATE TABLE IF NOT EXISTS controller (
id BIGSERIAL PRIMARY KEY,
Expand Down
2 changes: 1 addition & 1 deletion internal/dbmodel/sql/postgres/001_initial.up.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_1.sql initialises an empty database.
-- initialises an empty database.

CREATE TABLE IF NOT EXISTS audit_log (
id BIGSERIAL PRIMARY KEY,
Expand Down
2 changes: 1 addition & 1 deletion internal/dbmodel/sql/postgres/002_add_secrets.up.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_2.sql is a migration that adds a secrets table.
-- adds a secrets table.

CREATE TABLE IF NOT EXISTS secrets (
id BIGSERIAL PRIMARY KEY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_3.sql is a migration that alters the foreign key relationship `cloud_credentials.cloud_name -> clouds.name` to a cascade on-delete.
-- alters the foreign key relationship `cloud_credentials.cloud_name -> clouds.name` to a cascade on-delete.

ALTER TABLE cloud_credentials
DROP CONSTRAINT cloud_credentials_cloud_name_fkey,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_4.sql is a migration that removes unused tables and columns previously used for access checks.
-- removes unused tables and columns previously used for access checks.

DROP TABLE IF EXISTS user_application_offer_access;
DROP TABLE IF EXISTS user_cloud_access;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-- 1_5.sql is a migration that adds a column necessary for model migrations
-- adds a column necessary for model migrations

ALTER TABLE models ADD COLUMN migration_controller_id INTEGER REFERENCES controllers (id);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- 1_6.sql is a migration that adds access tokens to the user table
-- and is a migration that renames `user` to `identity`.
-- adds access tokens to the user table
-- and renames `user` to `identity`.

ALTER TABLE users ADD COLUMN access_token TEXT;
ALTER TABLE users ADD COLUMN refresh_token TEXT;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-- 1_7.sql is a migration that adds a UUID column to the groups table.
-- adds a UUID column to the groups table.

ALTER TABLE groups ADD COLUMN uuid TEXT NOT NULL UNIQUE;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-- 1_8.sql is a migration that adds a tls_hostname column to the controller table.
-- adds a tls_hostname column to the controller table.

ALTER TABLE controllers ADD COLUMN tls_hostname TEXT;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- 1_9.sql is a migration that deletes soft-deleted controllers and
-- drops the deleted_at column from the controllers table.
-- deletes soft-deleted controllers and drops the
-- deleted_at column from the controllers table.

DELETE FROM controllers WHERE deleted_at IS NOT null;
ALTER TABLE controllers DROP COLUMN deleted_at;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-- 1_10.sql is a migration that enforces a stricter uniqueness
-- constraint on model names.
-- enforces a stricter uniqueness constraint on model names.

ALTER TABLE models DROP CONSTRAINT models_controller_id_owner_identity_name_name_key;
ALTER TABLE models ADD CONSTRAINT unique_model_names UNIQUE(owner_identity_name, name);
2 changes: 1 addition & 1 deletion internal/dbmodel/sql/postgres/011_unique_offer_urls.up.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-- 1_11.sql is a migration that enforces uniqueness on URLs in application offers.
-- enforces uniqueness on URLs in application offers.

ALTER TABLE application_offers ADD UNIQUE (url);
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-- 1_12.sql is a migration that deletes soft-deleted groups and
-- drops the deleted_at column from the groups table.
-- deletes soft-deleted groups and drops the deleted_at column from the groups table.

DELETE FROM groups WHERE deleted_at IS NOT null;
ALTER TABLE groups DROP COLUMN deleted_at;
2 changes: 1 addition & 1 deletion internal/dbmodel/sql/postgres/013_add_roles.up.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_13.sql is a migration that introduces the concept of roles to JIMM.
-- introduces the concept of roles to JIMM.

CREATE TABLE IF NOT EXISTS roles (
id BIGSERIAL PRIMARY KEY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_14.sql is a migration simplifies application offers
-- simplifies application offers

DROP INDEX IF EXISTS idx_application_offer_connections_deleted_at;
DROP INDEX IF EXISTS idx_application_offer_remote_endpoints_deleted_at;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-- 1_15.sql is a migration to delete controller configs
-- delete controller configs table

DROP TABLE controller_configs;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-- 1_16.sql is a migration to delete identitymodel defaults
-- delete identitymodel defaults table

DROP TABLE identity_model_defaults;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- 1_17.sql remove non essential fields from model.
-- remove non essential fields from model.

ALTER TABLE models DROP COLUMN default_series, DROP COLUMN migration_controller_id, DROP COLUMN is_controller, DROP COLUMN cores,
DROP COLUMN machines, DROP COLUMN units, DROP COLUMN type, DROP COLUMN status_status, DROP COLUMN status_info, DROP COLUMN status_data,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-- 1_18.sql drops the versions table
-- deletes the versions table

DROP TABLE IF EXISTS versions;

0 comments on commit 9232343

Please sign in to comment.