|
| 1 | +"""Remove deprecated/unused tables |
| 2 | +
|
| 3 | +Revision ID: 484711f5be4a |
| 4 | +Revises: 5909cc18ab46 |
| 5 | +Create Date: 2026-01-26 18:34:43.371347 |
| 6 | +
|
| 7 | +""" |
| 8 | +import sqlalchemy as sa |
| 9 | +from alembic import op |
| 10 | +from sqlalchemy.dialects import postgresql |
| 11 | + |
| 12 | +# revision identifiers, used by Alembic. |
| 13 | +revision = "484711f5be4a" |
| 14 | +down_revision = "5909cc18ab46" |
| 15 | +branch_labels = None |
| 16 | +depends_on = None |
| 17 | + |
| 18 | + |
| 19 | +def upgrade(): |
| 20 | + # ### commands auto generated by Alembic - please adjust! ### |
| 21 | + op.drop_table("support") |
| 22 | + op.drop_table("support_listing") |
| 23 | + op.drop_table("crawl_job") |
| 24 | + # ### end Alembic commands ### |
| 25 | + |
| 26 | + |
| 27 | +def downgrade(): |
| 28 | + # ### commands auto generated by Alembic - please adjust! ### |
| 29 | + op.create_table( |
| 30 | + "crawl_job", |
| 31 | + sa.Column( |
| 32 | + "prompt_name", |
| 33 | + sa.TEXT(), |
| 34 | + autoincrement=False, |
| 35 | + nullable=True, |
| 36 | + comment="Name of the prompt to use for this crawl job (optional if using scraper function)", |
| 37 | + ), |
| 38 | + sa.Column( |
| 39 | + "domain", sa.TEXT(), autoincrement=False, nullable=False, comment="Domain to crawl" |
| 40 | + ), |
| 41 | + sa.Column( |
| 42 | + "crawling_interval", |
| 43 | + sa.INTEGER(), |
| 44 | + autoincrement=False, |
| 45 | + nullable=False, |
| 46 | + comment="Crawling interval in hours (positive integer)", |
| 47 | + ), |
| 48 | + sa.Column("id", sa.UUID(), autoincrement=False, nullable=False), |
| 49 | + sa.Column( |
| 50 | + "created_at", |
| 51 | + postgresql.TIMESTAMP(timezone=True), |
| 52 | + server_default=sa.text("now()"), |
| 53 | + autoincrement=False, |
| 54 | + nullable=False, |
| 55 | + ), |
| 56 | + sa.Column( |
| 57 | + "updated_at", |
| 58 | + postgresql.TIMESTAMP(timezone=True), |
| 59 | + server_default=sa.text("now()"), |
| 60 | + autoincrement=False, |
| 61 | + nullable=False, |
| 62 | + ), |
| 63 | + sa.Column( |
| 64 | + "last_crawled_at", |
| 65 | + postgresql.TIMESTAMP(timezone=True), |
| 66 | + autoincrement=False, |
| 67 | + nullable=True, |
| 68 | + comment="Timestamp of the last successful crawl", |
| 69 | + ), |
| 70 | + sa.PrimaryKeyConstraint("id", name=op.f("crawl_job_pkey")), |
| 71 | + sa.UniqueConstraint( |
| 72 | + "domain", |
| 73 | + name=op.f("crawl_job_domain_uniq"), |
| 74 | + postgresql_include=[], |
| 75 | + postgresql_nulls_not_distinct=False, |
| 76 | + ), |
| 77 | + ) |
| 78 | + op.create_table( |
| 79 | + "support_listing", |
| 80 | + sa.Column( |
| 81 | + "name", |
| 82 | + sa.TEXT(), |
| 83 | + autoincrement=False, |
| 84 | + nullable=False, |
| 85 | + comment="name of the support listing; a human-readable identifier", |
| 86 | + ), |
| 87 | + sa.Column( |
| 88 | + "uri", |
| 89 | + sa.TEXT(), |
| 90 | + autoincrement=False, |
| 91 | + nullable=False, |
| 92 | + comment="origin of the Support Listing; a file path or a website URL", |
| 93 | + ), |
| 94 | + sa.Column("id", sa.UUID(), autoincrement=False, nullable=False), |
| 95 | + sa.Column( |
| 96 | + "created_at", |
| 97 | + postgresql.TIMESTAMP(timezone=True), |
| 98 | + server_default=sa.text("now()"), |
| 99 | + autoincrement=False, |
| 100 | + nullable=False, |
| 101 | + ), |
| 102 | + sa.Column( |
| 103 | + "updated_at", |
| 104 | + postgresql.TIMESTAMP(timezone=True), |
| 105 | + server_default=sa.text("now()"), |
| 106 | + autoincrement=False, |
| 107 | + nullable=False, |
| 108 | + ), |
| 109 | + sa.PrimaryKeyConstraint("id", name="support_listing_pkey"), |
| 110 | + sa.UniqueConstraint( |
| 111 | + "name", |
| 112 | + name="support_listing_name_uniq", |
| 113 | + postgresql_include=[], |
| 114 | + postgresql_nulls_not_distinct=False, |
| 115 | + ), |
| 116 | + postgresql_ignore_search_path=False, |
| 117 | + ) |
| 118 | + op.create_table( |
| 119 | + "support", |
| 120 | + sa.Column("support_listing_id", sa.UUID(), autoincrement=False, nullable=False), |
| 121 | + sa.Column( |
| 122 | + "name", |
| 123 | + sa.TEXT(), |
| 124 | + autoincrement=False, |
| 125 | + nullable=False, |
| 126 | + comment="The name for the support resource", |
| 127 | + ), |
| 128 | + sa.Column( |
| 129 | + "addresses", |
| 130 | + postgresql.ARRAY(sa.TEXT()), |
| 131 | + autoincrement=False, |
| 132 | + nullable=False, |
| 133 | + comment="The address(es), as a list, of the support resource", |
| 134 | + ), |
| 135 | + sa.Column( |
| 136 | + "phone_numbers", |
| 137 | + postgresql.ARRAY(sa.TEXT()), |
| 138 | + autoincrement=False, |
| 139 | + nullable=False, |
| 140 | + comment="The phone number(s), as a list, of the support resource", |
| 141 | + ), |
| 142 | + sa.Column( |
| 143 | + "description", |
| 144 | + sa.TEXT(), |
| 145 | + autoincrement=False, |
| 146 | + nullable=True, |
| 147 | + comment="Description summarizing the resource", |
| 148 | + ), |
| 149 | + sa.Column( |
| 150 | + "website", |
| 151 | + sa.TEXT(), |
| 152 | + autoincrement=False, |
| 153 | + nullable=True, |
| 154 | + comment="The full URL for the resource", |
| 155 | + ), |
| 156 | + sa.Column( |
| 157 | + "email_addresses", |
| 158 | + postgresql.ARRAY(sa.TEXT()), |
| 159 | + autoincrement=False, |
| 160 | + nullable=False, |
| 161 | + comment="The email address(es) as a list to contact the resource", |
| 162 | + ), |
| 163 | + sa.Column("id", sa.UUID(), autoincrement=False, nullable=False), |
| 164 | + sa.Column( |
| 165 | + "created_at", |
| 166 | + postgresql.TIMESTAMP(timezone=True), |
| 167 | + server_default=sa.text("now()"), |
| 168 | + autoincrement=False, |
| 169 | + nullable=False, |
| 170 | + ), |
| 171 | + sa.Column( |
| 172 | + "updated_at", |
| 173 | + postgresql.TIMESTAMP(timezone=True), |
| 174 | + server_default=sa.text("now()"), |
| 175 | + autoincrement=False, |
| 176 | + nullable=False, |
| 177 | + ), |
| 178 | + sa.ForeignKeyConstraint( |
| 179 | + ["support_listing_id"], |
| 180 | + ["support_listing.id"], |
| 181 | + name=op.f("support_support_listing_id_support_listing_fkey"), |
| 182 | + ondelete="CASCADE", |
| 183 | + ), |
| 184 | + sa.PrimaryKeyConstraint("id", name=op.f("support_pkey")), |
| 185 | + ) |
| 186 | + # ### end Alembic commands ### |
0 commit comments