-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #315 from GSA/feature/art_language_db_migration
Adding art_language db table
- Loading branch information
Showing
8 changed files
with
149 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -137,7 +137,7 @@ $RECYCLE.BIN/ | |
|
||
### Data ### | ||
*.json | ||
*.sql | ||
data/*.sql | ||
*.xml | ||
*.csv | ||
!html_tags.txt | ||
|
This file contains 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
File renamed without changes.
39 changes: 39 additions & 0 deletions
39
alembic/versions/2e38f559933b_adding_art_language_table.py
This file contains 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,39 @@ | ||
"""Adding art language table | ||
Revision ID: 2e38f559933b | ||
Revises: 78823e9293e9 | ||
Create Date: 2024-06-25 14:55:27.913403 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
from sqlalchemy.dialects.postgresql import JSONB | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '2e38f559933b' | ||
down_revision = None | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('art_language', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('solicitation_id', sa.Integer(), nullable=True), | ||
sa.Column('language', JSONB(), nullable=False), | ||
sa.Column('createdAt', sa.DateTime(), nullable=False), | ||
sa.Column('updatedAt', sa.DateTime(), nullable=True), | ||
sa.ForeignKeyConstraint(['solicitation_id'], ['solicitations.id'], name=op.f('fk_art_language_solicitation_solicitations')), | ||
sa.PrimaryKeyConstraint('id', name=op.f('pk_art_language')) | ||
) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
|
||
op.drop_table('art_language') | ||
# ### end Alembic commands ### |
This file contains 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,15 @@ | ||
BEGIN; | ||
|
||
CREATE TABLE art_language ( | ||
id SERIAL NOT NULL, | ||
solicitation_id INTEGER, | ||
language JSONB NOT NULL, | ||
"createdAt" TIMESTAMP WITHOUT TIME ZONE NOT NULL, | ||
"updatedAt" TIMESTAMP WITHOUT TIME ZONE, | ||
CONSTRAINT pk_art_language PRIMARY KEY (id), | ||
CONSTRAINT fk_art_language_solicitation_solicitations FOREIGN KEY(solicitation_id) REFERENCES solicitations (id) | ||
); | ||
|
||
INSERT INTO alembic_version (version_num) VALUES ('2e38f559933b') RETURNING alembic_version.version_num; | ||
|
||
COMMIT; |
This file contains 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,79 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE "Agencies" ALTER COLUMN "updatedAt" DROP NOT NULL; | ||
|
||
ALTER TABLE "Predictions" ADD COLUMN "eitLikelihood" JSONB; | ||
|
||
ALTER TABLE "Predictions" ADD COLUMN active BOOLEAN DEFAULT true; | ||
|
||
ALTER TABLE "Predictions" ALTER COLUMN title SET NOT NULL; | ||
|
||
ALTER TABLE "Predictions" ALTER COLUMN "solNum" SET NOT NULL; | ||
|
||
ALTER TABLE "Predictions" ALTER COLUMN "noticeType" SET NOT NULL; | ||
|
||
ALTER TABLE "Predictions" ALTER COLUMN "createdAt" SET NOT NULL; | ||
|
||
ALTER TABLE "Predictions" ALTER COLUMN history SET DEFAULT '[]'::jsonb; | ||
|
||
ALTER TABLE "Predictions" ADD CONSTRAINT "uq_Predictions_solNum" UNIQUE ("solNum"); | ||
|
||
ALTER TABLE "Predictions" DROP COLUMN feedback; | ||
|
||
ALTER TABLE "Predictions" DROP COLUMN category_list; | ||
|
||
ALTER TABLE "Surveys" ALTER COLUMN "updatedAt" DROP NOT NULL; | ||
|
||
ALTER TABLE "Users" ALTER COLUMN "updatedAt" DROP NOT NULL; | ||
|
||
ALTER TABLE agency_alias ALTER COLUMN agency_id SET NOT NULL; | ||
|
||
ALTER TABLE agency_alias ALTER COLUMN "createdAt" SET NOT NULL; | ||
|
||
ALTER TABLE agency_alias ALTER COLUMN "createdAt" SET DEFAULT now(); | ||
|
||
ALTER TABLE agency_alias ALTER COLUMN "updatedAt" DROP NOT NULL; | ||
|
||
ALTER TABLE notice_type ADD COLUMN "createdAt" TIMESTAMP WITHOUT TIME ZONE NOT NULL; | ||
|
||
ALTER TABLE notice_type ADD COLUMN "updatedAt" TIMESTAMP WITHOUT TIME ZONE; | ||
|
||
ALTER TABLE survey_responses ALTER COLUMN "createdAt" SET NOT NULL; | ||
|
||
CREATE INDEX "ix_survey_responses_solNum" ON survey_responses ("solNum"); | ||
|
||
ALTER TABLE survey_responses_archive ALTER COLUMN "createdAt" SET NOT NULL; | ||
|
||
ALTER TABLE survey_responses_archive ALTER COLUMN "createdAt" SET DEFAULT now(); | ||
|
||
ALTER TABLE survey_responses_archive ALTER COLUMN "updatedAt" DROP NOT NULL; | ||
|
||
ALTER TABLE survey_responses_archive ALTER COLUMN response SET DEFAULT '[]'::jsonb; | ||
|
||
ALTER TABLE solicitations ADD CONSTRAINT "uq_solicitations_solNum" UNIQUE ("solNum"); | ||
|
||
ALTER TABLE solicitations ALTER COLUMN history SET DEFAULT '[]'::jsonb; | ||
|
||
ALTER TABLE solicitations ALTER COLUMN action SET DEFAULT '[]'::jsonb; | ||
|
||
ALTER TABLE solicitations ALTER COLUMN predictions SET DEFAULT '{"value": "red", "history": []}'::jsonb; | ||
|
||
ALTER TABLE solicitations ALTER COLUMN compliant SET DEFAULT 0; | ||
|
||
ALTER TABLE solicitations ALTER COLUMN active SET DEFAULT true; | ||
|
||
ALTER TABLE solicitations ALTER COLUMN na_flag SET DEFAULT false; | ||
|
||
ALTER TABLE solicitations ALTER COLUMN "updateAt" DROP NOT NULL; | ||
|
||
ALTER TABLE attachment ALTER COLUMN "createdAt" SET NOT NULL; | ||
|
||
ALTER TABLE attachment ALTER COLUMN "createdAt" SET DEFAULT now(); | ||
|
||
ALTER TABLE notice ALTER COLUMN "createdAt" SET NOT NULL; | ||
|
||
ALTER TABLE notice ALTER COLUMN "createdAt" SET DEFAULT now(); | ||
|
||
|
||
COMMIT; | ||
|
This file contains 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
This file contains 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