From 32c7dc8c43b80259578ee5dca39ff861a954b145 Mon Sep 17 00:00:00 2001 From: Thomas Date: Thu, 11 Aug 2022 00:58:52 -0700 Subject: [PATCH 01/11] Prepend `ctl` to database table names --- src/fidesctl/api/ctl/sql_models.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fidesctl/api/ctl/sql_models.py b/src/fidesctl/api/ctl/sql_models.py index 3127edb78a..5b54bc26cd 100644 --- a/src/fidesctl/api/ctl/sql_models.py +++ b/src/fidesctl/api/ctl/sql_models.py @@ -91,7 +91,7 @@ class DataCategory(Base, FidesBase): The SQL model for the DataCategory resource. """ - __tablename__ = "data_categories" + __tablename__ = "ctl_data_categories" parent_key = Column(Text) @@ -101,7 +101,7 @@ class DataQualifier(Base, FidesBase): The SQL model for the DataQualifier resource. """ - __tablename__ = "data_qualifiers" + __tablename__ = "ctl_data_qualifiers" parent_key = Column(Text) @@ -111,7 +111,7 @@ class DataSubject(Base, FidesBase): The SQL model for the DataSubject resource. """ - __tablename__ = "data_subjects" + __tablename__ = "ctl_data_subjects" rights = Column(JSON, nullable=True) automated_decisions_or_profiling = Column(BOOLEAN, nullable=True) @@ -121,7 +121,7 @@ class DataUse(Base, FidesBase): The SQL model for the DataUse resource. """ - __tablename__ = "data_uses" + __tablename__ = "ctl_data_uses" parent_key = Column(Text) legal_basis = Column(Text) @@ -137,7 +137,7 @@ class Dataset(Base, FidesBase): The SQL model for the Dataset resource. """ - __tablename__ = "datasets" + __tablename__ = "ctl_datasets" meta = Column(JSON) data_categories = Column(ARRAY(String)) @@ -155,7 +155,7 @@ class Evaluation(Base): The SQL model for the Evaluation resource. """ - __tablename__ = "evaluations" + __tablename__ = "ctl_evaluations" fides_key = Column(String, primary_key=True, index=True, unique=True) status = Column(String) @@ -170,7 +170,7 @@ class Organization(Base, FidesBase): """ # It inherits this from FidesModel but Organization's don't have this field - __tablename__ = "organizations" + __tablename__ = "ctl_organizations" organization_parent_key = Column(String, nullable=True) controller = Column(PGEncryptedString, nullable=True) @@ -186,7 +186,7 @@ class Policy(Base, FidesBase): The SQL model for the Policy resource. """ - __tablename__ = "policies" + __tablename__ = "ctl_policies" rules = Column(JSON) @@ -197,7 +197,7 @@ class Registry(Base, FidesBase): The SQL model for the Registry resource. """ - __tablename__ = "registries" + __tablename__ = "ctl_registries" # System @@ -206,7 +206,7 @@ class System(Base, FidesBase): The SQL model for the system resource. """ - __tablename__ = "systems" + __tablename__ = "ctl_systems" registry_id = Column(String) meta = Column(JSON) From 0879a28c1f71e2d3b7ae685c4558eeb6c08e8a9e Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 12 Aug 2022 00:15:00 +0800 Subject: [PATCH 02/11] rename the tables --- .../aaa81d97a6f6_prepend_tables_with_ctl.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py diff --git a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py new file mode 100644 index 0000000000..311a66900a --- /dev/null +++ b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py @@ -0,0 +1,44 @@ +"""prepend tables with ctl + +Revision ID: aaa81d97a6f6 +Revises: f53e04e5b7f5 +Create Date: 2022-08-11 09:59:38.709501 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = "aaa81d97a6f6" +down_revision = "f53e04e5b7f5" +branch_labels = None +depends_on = None + + +def upgrade(): + + op.rename_table("data_categories", "ctl_data_categories") + op.rename_table("data_subjects", "ctl_data_subjects") + op.rename_table("data_uses", "ctl_data_uses") + op.rename_table("data_qualifiers", "ctl_data_qualifiers") + op.rename_table("datasets", "ctl_datasets") + op.rename_table("evaluations", "ctl_evaluations") + op.rename_table("organizations", "ctl_organizations") + op.rename_table("policies", "ctl_policies") + op.rename_table("registries", "ctl_registries") + op.rename_table("systems", "ctl_systems") + + +def downgrade(): + + op.rename_table("ctl_data_categories", "data_categories") + op.rename_table("ctl_data_subjects", "data_subjects") + op.rename_table("ctl_data_uses", "data_uses") + op.rename_table("ctl_data_qualifiers", "data_qualifiers") + op.rename_table("ctl_datasets", "datasets") + op.rename_table("ctl_evaluations", "evaluations") + op.rename_table("ctl_organizations", "organizations") + op.rename_table("ctl_policies", "policies") + op.rename_table("ctl_registries", "registries") + op.rename_table("ctl_systems", "systems") From 0f3268d2204c6218106245d871059c5cf71c9453 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 15 Aug 2022 18:49:22 +0800 Subject: [PATCH 03/11] fix past migrations that broke with the table name update --- ...51d8a102a_add_created_at_and_updated_at.py | 69 ++++++++++--------- .../aaa81d97a6f6_prepend_tables_with_ctl.py | 1 + 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/fidesctl/api/ctl/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py b/src/fidesctl/api/ctl/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py index c7c6a0a8ab..9927ddbf42 100644 --- a/src/fidesctl/api/ctl/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py +++ b/src/fidesctl/api/ctl/migrations/versions/7c851d8a102a_add_created_at_and_updated_at.py @@ -16,40 +16,45 @@ branch_labels = None depends_on = None +SQL_MODEL_LIST = [ + "data_categories", + "data_qualifiers", + "data_uses", + "data_subjects", + "datasets", + "evaluations", + "policies", + "registries", + "systems", + "organizations", +] + def upgrade(): - for k, model in sql_model_map.items(): - if k not in ( - "client_detail", - "fides_user", - "fides_user_permissions", - ): - op.add_column( - model.__tablename__, - Column( - "created_at", - DateTime(timezone=True), - server_default=text("now()"), - nullable=True, - ), - ) - op.add_column( - model.__tablename__, - Column( - "updated_at", - DateTime(timezone=True), - server_default=text("now()"), - nullable=True, - ), - ) + + for table_name in SQL_MODEL_LIST: + op.add_column( + table_name, + Column( + "created_at", + DateTime(timezone=True), + server_default=text("now()"), + nullable=True, + ), + ) + op.add_column( + table_name, + Column( + "updated_at", + DateTime(timezone=True), + server_default=text("now()"), + nullable=True, + ), + ) def downgrade(): - for k, model in sql_model_map.items(): - if k not in ( - "client_detail", - "fides_user", - "fides_user_permissions", - ): - op.drop_column(model.__tablename__, "created_at") - op.drop_column(model.__tablename__, "updated_at") + + for table_name in SQL_MODEL_LIST: + op.drop_column(table_name, "created_at") + op.drop_column(table_name, "updated_at") diff --git a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py index 311a66900a..b866d1a688 100644 --- a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py +++ b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py @@ -17,6 +17,7 @@ def upgrade(): + """Rename tables to avoid collisions with fidesops.""" op.rename_table("data_categories", "ctl_data_categories") op.rename_table("data_subjects", "ctl_data_subjects") From 34e316bb244b75dc918def77814b44cc03a974f9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 15 Aug 2022 19:23:45 +0800 Subject: [PATCH 04/11] update dataset.yml, fix isort issue --- .fides/dataset.yml | 22 +++++++++---------- .../aaa81d97a6f6_prepend_tables_with_ctl.py | 2 -- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.fides/dataset.yml b/.fides/dataset.yml index 3c9cea741f..2db0c8ef26 100644 --- a/.fides/dataset.yml +++ b/.fides/dataset.yml @@ -144,7 +144,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: data_categories + - name: ctl_data_categories description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -213,7 +213,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: data_qualifiers + - name: ctl_data_qualifiers description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -282,7 +282,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: data_subjects + - name: ctl_data_subjects description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -360,7 +360,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: data_uses + - name: ctl_data_uses description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -465,7 +465,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: datasets + - name: ctl_datasets description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -607,7 +607,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: evaluations + - name: ctl_evaluations description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -786,7 +786,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: organizations + - name: ctl_organizations description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -893,7 +893,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: policies + - name: ctl_policies description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -962,7 +962,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: registries + - name: ctl_registries description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -1024,7 +1024,7 @@ dataset: data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null fields: null - - name: systems + - name: ctl_systems description: null data_categories: null data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified @@ -1164,4 +1164,4 @@ dataset: - system.operations data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null - fields: null + fields: null diff --git a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py index b866d1a688..c77c2d722c 100644 --- a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py +++ b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py @@ -6,8 +6,6 @@ """ from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "aaa81d97a6f6" From 74a84ecefc08f9ecad50e139c598efe9bddeb7f7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 15 Aug 2022 20:33:05 +0800 Subject: [PATCH 05/11] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef0564550f..569b480f9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The types of changes are: ### Changed * Upgraded base Docker version to Python 3.9 and updated all other references from 3.8 -> 3.9 [#974](https://github.com/ethyca/fides/pull/974) +* Prepend all database tables with `ctl_` [#979](https://github.com/ethyca/fides/pull/979) * Moved the `admin-ui` code down one level into a `ctl` subdir [#970](https://github.com/ethyca/fides/pull/970) ## [1.8.1](https://github.com/ethyca/fides/compare/1.8.0...1.8.1) - 2022-08-08 From cfe4d5d23e1cbb6f0591d1468c35ea2eb68ca696 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 15 Aug 2022 20:59:59 +0800 Subject: [PATCH 06/11] small dataset fix --- .fides/dataset.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.fides/dataset.yml b/.fides/dataset.yml index 2db0c8ef26..c95b405805 100644 --- a/.fides/dataset.yml +++ b/.fides/dataset.yml @@ -1164,4 +1164,4 @@ dataset: - system.operations data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified retention: null - fields: null + fields: null From d23f1819ff4adc2b1f78f376a17875abc7b1ef03 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 16 Aug 2022 01:21:27 +0800 Subject: [PATCH 07/11] update the indexes --- .../aaa81d97a6f6_prepend_tables_with_ctl.py | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py index c77c2d722c..c0a032e22d 100644 --- a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py +++ b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py @@ -17,27 +17,152 @@ def upgrade(): """Rename tables to avoid collisions with fidesops.""" + # Data Categories op.rename_table("data_categories", "ctl_data_categories") + op.execute("ALTER INDEX data_categories_pkey RENAME TO ctl_data_categories_pkey") + op.execute( + "ALTER INDEX ix_data_categories_fides_key RENAME TO ix_ctl_data_categories_fides_key" + ) + op.execute("ALTER INDEX ix_data_categories_id RENAME TO ix_ctl_data_categories_id") + + # Data Subjects op.rename_table("data_subjects", "ctl_data_subjects") + op.execute("ALTER INDEX data_subjects_pkey RENAME TO ctl_data_subjects_pkey") + op.execute( + "ALTER INDEX ix_data_subjects_fides_key RENAME TO ix_ctl_data_subjects_fides_key" + ) + op.execute("ALTER INDEX ix_data_subjects_id RENAME TO ix_ctl_data_subjects_id") + + # Data Uses op.rename_table("data_uses", "ctl_data_uses") + op.execute("ALTER INDEX data_uses_pkey RENAME TO ctl_data_uses_pkey") + op.execute( + "ALTER INDEX ix_data_uses_fides_key RENAME TO ix_ctl_data_uses_fides_key" + ) + op.execute("ALTER INDEX ix_data_uses_id RENAME TO ix_ctl_data_uses_id") + + # Data Qualifiers op.rename_table("data_qualifiers", "ctl_data_qualifiers") + op.execute("ALTER INDEX data_qualifiers_pkey RENAME TO ctl_data_qualifiers_pkey") + op.execute( + "ALTER INDEX ix_data_qualifiers_fides_key RENAME TO ix_ctl_data_qualifiers_fides_key" + ) + op.execute("ALTER INDEX ix_data_qualifiers_id RENAME TO ix_ctl_data_qualifiers_id") + + # Datasets op.rename_table("datasets", "ctl_datasets") + op.execute("ALTER INDEX datasets_pkey RENAME TO ctl_datasets_pkey") + op.execute("ALTER INDEX ix_datasets_fides_key RENAME TO ix_ctl_datasets_fides_key") + op.execute("ALTER INDEX ix_datasets_id RENAME TO ix_ctl_datasets_id") + + # Evaluations op.rename_table("evaluations", "ctl_evaluations") + op.execute("ALTER INDEX evaluations_pkey RENAME TO ctl_evaluations_pkey") + op.execute( + "ALTER INDEX ix_evaluations_fides_key RENAME TO ix_ctl_evaluations_fides_key" + ) + op.execute("ALTER INDEX ix_evaluations_id RENAME TO ix_ctl_evaluations_id") + + # Organizations op.rename_table("organizations", "ctl_organizations") + op.execute("ALTER INDEX organizations_pkey RENAME TO ctl_organizations_pkey") + op.execute( + "ALTER INDEX ix_organizations_fides_key RENAME TO ix_ctl_organizations_fides_key" + ) + op.execute("ALTER INDEX ix_organizations_id RENAME TO ix_ctl_organizations_id") + + # Policies op.rename_table("policies", "ctl_policies") + op.execute("ALTER INDEX policies_pkey RENAME TO ctl_policies_pkey") + op.execute("ALTER INDEX ix_policies_fides_key RENAME TO ix_ctl_policies_fides_key") + op.execute("ALTER INDEX ix_policies_id RENAME TO ix_ctl_policies_id") + + # Registries op.rename_table("registries", "ctl_registries") + op.execute("ALTER INDEX registries_pkey RENAME TO ctl_registries_pkey") + op.execute( + "ALTER INDEX ix_registries_fides_key RENAME TO ix_ctl_registries_fides_key" + ) + op.execute("ALTER INDEX ix_registries_id RENAME TO ix_ctl_registries_id") + + # Systems op.rename_table("systems", "ctl_systems") + op.execute("ALTER INDEX systems_pkey RENAME TO ctl_systems_pkey") + op.execute("ALTER INDEX ix_systems_fides_key RENAME TO ix_ctl_systems_fides_key") + op.execute("ALTER INDEX ix_systems_id RENAME TO ix_ctl_systems_id") def downgrade(): op.rename_table("ctl_data_categories", "data_categories") + op.execute("ALTER INDEX ctl_data_categories_pkey RENAME TO data_categories_pkey") + op.execute( + "ALTER INDEX ix_ctl_data_categories_fides_key RENAME TO ix_data_categories_fides_key" + ) + op.execute("ALTER INDEX ix_ctl_data_categories_id RENAME TO ix_data_categories_id") + + # Data Subjects op.rename_table("ctl_data_subjects", "data_subjects") + op.execute("ALTER INDEX ctl_data_subjects_pkey RENAME TO data_subjects_pkey") + op.execute( + "ALTER INDEX ix_ctl_data_subjects_fides_key RENAME TO ix_data_subjects_fides_key" + ) + op.execute("ALTER INDEX ix_ctl_data_subjects_id RENAME TO ix_data_subjects_id") + + # Data Uses op.rename_table("ctl_data_uses", "data_uses") + op.execute("ALTER INDEX ctl_data_uses_pkey RENAME TO data_uses_pkey") + op.execute( + "ALTER INDEX ix_ctl_data_uses_fides_key RENAME TO ix_data_uses_fides_key" + ) + op.execute("ALTER INDEX ix_ctl_data_uses_id RENAME TO ix_data_uses_id") + + # Data Qualifiers op.rename_table("ctl_data_qualifiers", "data_qualifiers") + op.execute("ALTER INDEX ctl_data_qualifiers_pkey RENAME TO data_qualifiers_pkey") + op.execute( + "ALTER INDEX ix_ctl_data_qualifiers_fides_key RENAME TO ix_data_qualifiers_fides_key" + ) + op.execute("ALTER INDEX ix_ctl_data_qualifiers_id RENAME TO ix_data_qualifiers_id") + + # Datasets op.rename_table("ctl_datasets", "datasets") + op.execute("ALTER INDEX ctl_datasets_pkey RENAME TO datasets_pkey") + op.execute("ALTER INDEX ix_ctl_datasets_fides_key RENAME TO ix_datasets_fides_key") + op.execute("ALTER INDEX ix_ctl_datasets_id RENAME TO ix_datasets_id") + + # Evaluations op.rename_table("ctl_evaluations", "evaluations") + op.execute("ALTER INDEX ctl_evaluations_pkey RENAME TO evaluations_pkey") + op.execute( + "ALTER INDEX ix_ctl_evaluations_fides_key RENAME TO ix_evaluations_fides_key" + ) + op.execute("ALTER INDEX ix_ctl_evaluations_id RENAME TO ix_evaluations_id") + + # Organizations op.rename_table("ctl_organizations", "organizations") + op.execute("ALTER INDEX ctl_organizations_pkey RENAME TO organizations_pkey") + op.execute( + "ALTER INDEX ix_ctl_organizations_fides_key RENAME TO ix_organizations_fides_key" + ) + op.execute("ALTER INDEX ix_ctl_organizations_id RENAME TO ix_organizations_id") + + # Policies op.rename_table("ctl_policies", "policies") + op.execute("ALTER INDEX ctl_policies_pkey RENAME TO policies_pkey") + op.execute("ALTER INDEX ix_ctl_policies_fides_key RENAME TO ix_policies_fides_key") + op.execute("ALTER INDEX ix_ctl_policies_id RENAME TO ix_policies_id") + + # Registries op.rename_table("ctl_registries", "registries") + op.execute("ALTER INDEX ctl_registries_pkey RENAME TO registries_pkey") + op.execute( + "ALTER INDEX ix_ctl_registries_fides_key RENAME TO ix_registries_fides_key" + ) + op.execute("ALTER INDEX ix_ctl_registries_id RENAME TO ix_registries_id") + + # Systems op.rename_table("ctl_systems", "systems") + op.execute("ALTER INDEX ctl_systems_pkey RENAME TO systems_pkey") + op.execute("ALTER INDEX ix_ctl_systems_fides_key RENAME TO ix_systems_fides_key") + op.execute("ALTER INDEX ix_ctl_systems_id RENAME TO ix_systems_id") From 4610799ab428dd76388dd42b3a2388f9220de615 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 16 Aug 2022 01:55:03 +0800 Subject: [PATCH 08/11] fix a misspelled index rename --- .../migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py index c0a032e22d..0a121dc8ac 100644 --- a/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py +++ b/src/fidesctl/api/ctl/migrations/versions/aaa81d97a6f6_prepend_tables_with_ctl.py @@ -51,7 +51,7 @@ def upgrade(): # Datasets op.rename_table("datasets", "ctl_datasets") - op.execute("ALTER INDEX datasets_pkey RENAME TO ctl_datasets_pkey") + op.execute("ALTER INDEX data_sets_pkey RENAME TO ctl_datasets_pkey") op.execute("ALTER INDEX ix_datasets_fides_key RENAME TO ix_ctl_datasets_fides_key") op.execute("ALTER INDEX ix_datasets_id RENAME TO ix_ctl_datasets_id") From 27ed47ed79f26bcc58adf06e00fdc01be87bc2ce Mon Sep 17 00:00:00 2001 From: Allison King Date: Wed, 17 Aug 2022 15:38:43 -0400 Subject: [PATCH 09/11] Merge alembic heads --- .../ctl/migrations/versions/4fc34906c389_.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py diff --git a/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py b/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py new file mode 100644 index 0000000000..998608c4ed --- /dev/null +++ b/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py @@ -0,0 +1,24 @@ +"""empty message + +Revision ID: 4fc34906c389 +Revises: aaa81d97a6f6, f131a1263a10 +Create Date: 2022-08-17 19:35:33.413593 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '4fc34906c389' +down_revision = ('aaa81d97a6f6', 'f131a1263a10') +branch_labels = None +depends_on = None + + +def upgrade(): + pass + + +def downgrade(): + pass From 5f723270d6b400a15d723c36602ed198fd95f707 Mon Sep 17 00:00:00 2001 From: Allison King Date: Wed, 17 Aug 2022 16:47:13 -0400 Subject: [PATCH 10/11] Format autogenerated alembic file --- src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py b/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py index 998608c4ed..41e934e7f0 100644 --- a/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py +++ b/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py @@ -5,13 +5,12 @@ Create Date: 2022-08-17 19:35:33.413593 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. -revision = '4fc34906c389' -down_revision = ('aaa81d97a6f6', 'f131a1263a10') +revision = "4fc34906c389" +down_revision = ("aaa81d97a6f6", "f131a1263a10") branch_labels = None depends_on = None From 11927341fc297c59419cb1b9ac3c837110e7f7b7 Mon Sep 17 00:00:00 2001 From: Allison King Date: Wed, 17 Aug 2022 17:04:04 -0400 Subject: [PATCH 11/11] Add a more useful alembic message --- src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py b/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py index 41e934e7f0..ed1bdf0c8a 100644 --- a/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py +++ b/src/fidesctl/api/ctl/migrations/versions/4fc34906c389_.py @@ -1,4 +1,4 @@ -"""empty message +"""Merge heads Revision ID: 4fc34906c389 Revises: aaa81d97a6f6, f131a1263a10